Skip to content

Commit

Permalink
build: added separate develop image
Browse files Browse the repository at this point in the history
  • Loading branch information
torbrenner committed Oct 30, 2023
1 parent 9094530 commit dbd5173
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 6 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/docker-develop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Build and Push Develop Image samply/lens-web-components

on:
push:
branches:
- develop
pull_request:
branches:
- develop
jobs:
build:
# This workflow defines how a samply docker image is built, tested and published.
# Visit: https://github.com/samply/github-workflows/blob/main/.github/workflows/docker-ci.yml, for more information
uses: samply/github-workflows/.github/workflows/docker-ci.yml@main
with:
image-name: "samply/lens-web-components"
build-args: |
TARGET_ENVIRONMENT=staging
# This passes the secrets from calling workflow to the called workflow
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
2 changes: 2 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ jobs:
uses: samply/github-workflows/.github/workflows/docker-ci.yml@main
with:
image-name: "samply/lens-web-components"
build-args: |
TARGET_ENVIRONMENT=production
# This passes the secrets from calling workflow to the called workflow
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
Expand Down
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
FROM node:lts as build
ARG TARGET_ENVIRONMENT="staging"
WORKDIR /usr/src/app
RUN sh -c '[ -z "$http_proxy" ] || ( npm config set proxy $http_proxy; npm config set https-proxy $http_proxy )'
COPY package.json package-lock.json ./
RUN npm install
COPY ./vite.config.ts ./vite.demo.config.ts ./extensions.json ./tsconfig.json ./tsconfig.node.json ./
COPY ./packages ./packages
RUN npm run build
RUN npm run build:demo
RUN VITE_TARGET_ENVIRONMENT=${TARGET_ENVIRONMENT} npm run build
RUN VITE_TARGET_ENVIRONMENT=${TARGET_ENVIRONMENT} npm run build:demo

FROM nginx:stable-alpine
COPY --from=build /usr/src/app/dist/demo /usr/share/nginx/html
8 changes: 6 additions & 2 deletions packages/demo/src/AppCCP.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,13 @@
["hamburg", "Hamburg"],
];
// VITE_TARGET_ENVIRONMENT should be set by the ci pipeline
const backendUrl = (import.meta.env.VITE_TARGET_ENVIRONMENT === "production")
? "https://backend.data.dktk.dkfz.de/prod/"
: "https://backend.demo.lens.samply.de/prod/"
const backendConfig = {
// url: "https://backend.demo.lens.samply.de/prod/",
url: "http://localhost:8080",
url: (import.meta.env.PROD) ? backendUrl : "http://localhost:8080",
backends: [
"mannheim",
"freiburg",
Expand Down
4 changes: 2 additions & 2 deletions packages/lib/src/classes/spot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class Spot {
`${this.url}tasks?sites=${this.sites.toString()}`,
{
method: 'POST',
credentials: 'include',
credentials: (import.meta.env.PROD) ? "include" : "omit",
body: query,
signal: controller.signal
}
Expand All @@ -54,7 +54,7 @@ export class Spot {
const beamResponses: Response = await fetch(
`${this.url}tasks/${this.currentTask}?wait_count=${responseCount + 1}`,
{
credentials: 'include',
credentials: (import.meta.env.PROD) ? "include" : "omit",
signal: controller.signal
}
)
Expand Down

0 comments on commit dbd5173

Please sign in to comment.