Skip to content

Commit

Permalink
added drone config (#69)
Browse files Browse the repository at this point in the history
* added drone config

* edited package json for production build
  • Loading branch information
S-Panta authored Dec 5, 2024
1 parent 31ec3e8 commit 5a846ab
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 10 deletions.
67 changes: 65 additions & 2 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ OC_CI_BUILDIFIER = "owncloudci/bazel-buildifier:latest"
SONARSOURCE_SONAR_SCANNER_CLI = "sonarsource/sonar-scanner-cli:5.0"
OC_CI_WAIT_FOR = "owncloudci/wait-for:latest"
OCIS_IMAGE = "owncloud/ocis:5.0"
PLUGINS_DOCKER = "plugins/docker:latest"

dir = {
"webConfig": "/drone/src/tests/drone/web.config.json",
Expand All @@ -12,7 +13,8 @@ def main(ctx):
return checkStarlark() + \
pnpmlint(ctx) + \
unitTestPipeline(ctx) + \
e2eTests()
e2eTests() + \
dockerRelease(ctx)

def checkStarlark():
return [{
Expand Down Expand Up @@ -106,7 +108,7 @@ def pnpmlint(ctx):
],
"trigger": {
"ref": [
"refs/heads/master",
"refs/heads/main",
"refs/pull/**",
],
},
Expand Down Expand Up @@ -221,3 +223,64 @@ def ocisService():
],
},
]

def dockerRelease(ctx):
tag = ctx.build.ref.replace("refs/tags/", "") if ctx.build.event == "tag" else "latest"

repo = "owncloud/web-app-dicom-viewer"
return [
{
"kind": "pipeline",
"type": "docker",
"name": "docker-daily",
"depends_on": ["e2e-tests"],
"steps": [
{
"name": "dryrun",
"image": PLUGINS_DOCKER,
"settings": {
"dry_run": True,
"tags": tag,
"dockerfile": "Dockerfile",
"repo": repo,
},
"when": {
"ref": {
"include": [
"refs/pull/**",
],
},
},
},
{
"name": "docker",
"image": PLUGINS_DOCKER,
"settings": {
"username": {
"from_secret": "docker_username",
},
"password": {
"from_secret": "docker_password",
},
"tags": tag,
"dockerfile": "Dockerfile",
"repo": repo,
},
"when": {
"ref": {
"exclude": [
"refs/pull/**",
],
},
},
},
],
"trigger": {
"ref": [
"refs/heads/main",
"refs/tags/v*",
"refs/pull/**",
],
},
},
]
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ WORKDIR /extension

COPY . .
RUN pnpm install
RUN pnpm build
RUN pnpm build:prod

FROM alpine:3.20
WORKDIR /app
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
"type": "module",
"scripts": {
"lint": "eslint './*.{ts,js}' '{src,tests}/**/*.{js,ts,vue}' --color",
"build": "pnpm vite build",
"build:w": "pnpm vite build --watch --mode development",
"build": "vite build",
"build:w": "pnpm build --watch --mode development",
"build:prod": "PRODUCTION=true pnpm build",
"test": "vitest",
"coverage": "vitest run --coverage",
"test:e2e": "NODE_TLS_REJECT_UNAUTHORIZED=0 TS_NODE_PROJECT=./tests/e2e/tsconfig.json cucumber-js"
Expand Down Expand Up @@ -73,4 +74,4 @@
}
},
"packageManager": "[email protected]"
}
}
17 changes: 13 additions & 4 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,26 @@ import { defineConfig } from '@ownclouders/extension-sdk'
import { readFileSync } from 'fs'
import { join } from 'path'

const certsDir = `${__dirname}/dev/docker/traefik/certificates`
const isProduction = process.env.PRODUCTION === 'true'

export default defineConfig({
server: {
let server

if (!isProduction) {
const certsDir = `${__dirname}/dev/docker/traefik/certificates`
server = {
port: 9999,
host: 'host.docker.internal',
https: {
key: readFileSync(join(certsDir, 'server.key')),
cert: readFileSync(join(certsDir, 'server.crt'))
}
},
}
} else {
server = false
}

export default defineConfig({
server,
build: {
rollupOptions: {
output: {
Expand Down

0 comments on commit 5a846ab

Please sign in to comment.