Skip to content

Commit

Permalink
Merge pull request #4 from samply/feature/ci-builds
Browse files Browse the repository at this point in the history
feat: added dev and prod builds
  • Loading branch information
enola-dkfz authored May 14, 2024
2 parents 9f94e3d + 1e6ee5e commit 7f667e5
Show file tree
Hide file tree
Showing 12 changed files with 2,399 additions and 2,176 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/release-develop.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: "Release new Develop Version"
on:
workflow_run:
workflows: ["Verify new Code"]
types:
- completed

jobs:
download-lib:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: "samply/lens-angular"
ref: "feature/eucaim-prototype"
path: "lib"
- uses: actions/upload-artifact@v4
with:
name: "lib"
path: "**"

build-and-publish:
uses: samply/github-workflows/.github/workflows/docker-ci.yml@main
needs: download-lib
with:
image-name: ${{ github.repository }}
build-platforms: 'linux/amd64'
artifact-name: '*'
push-to: dockerhub
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
20 changes: 20 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,30 @@ on:
- "[0-9]+.[0-9]+.[0-9]+"

jobs:
download-lib:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: "samply/lens-angular"
ref: "feature/eucaim-prototype"
path: "lib"
- uses: actions/upload-artifact@v4
with:
name: "lib"
path: "**"

build-and-publish:
uses: samply/github-workflows/.github/workflows/docker-ci.yml@main
needs: download-lib
with:
image-name: ${{ github.repository }}
build-platforms: 'linux/amd64'
build-args: |
PRODUCTION=true
artifact-name: '*'
push-to: dockerhub

secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/verify-new-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ jobs:
run: npm run lint:check-commits
- run: npm run lint:check

test:
needs: [verify-code]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
cache: 'npm'
- run: npm ci
- run: npm run test:headless
# test:
# needs: [verify-code]
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-node@v3
# with:
# node-version: 16
# cache: 'npm'
# - run: npm ci
# - run: npm run test:headless
22 changes: 19 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
FROM node:lts as build
WORKDIR /usr/src/app
ARG PRODUCTION=false
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 ./
# First build the lib
WORKDIR /usr/src/lib
COPY ./artifacts/lib/lib/package.json ./artifacts/lib/lib/package-lock.json ./
RUN npm install
COPY ./artifacts/lib/lib/angular.json ./artifacts/lib/lib/tsconfig.json ./
COPY ./artifacts/lib/lib/core ./core/
COPY ./artifacts/lib/lib/components ./components/
RUN npm run build @samply/lens-core && npm run build @samply/lens-components
RUN cd dist/samply/lens-core && npm link \
&& cd ../lens-components && npm link
# Second build the application
WORKDIR /usr/src/app
COPY package.json package-lock.json ./
RUN npm install && npm link @samply/lens-core @samply/lens-components
COPY ./angular.json ./tsconfig.json ./tsconfig.app.json ./tsconfig.spec.json ./
COPY ./src ./src
RUN npm run build
RUN if [ "${PRODUCTION}" = true ]; then \
npm run build:prod ${TARGET_PROJECT}; \
else \
npm run build ${TARGET_PROJECT}; \
fi;

FROM nginx:stable-alpine
ENV NGINX_PORT=80 NGINX_DEPLOYMENT_CONTEXT=/
Expand Down
Loading

0 comments on commit 7f667e5

Please sign in to comment.