From 56c758ab6683836d6125f9edab95da91ffc8e10d Mon Sep 17 00:00:00 2001 From: Lasse Alm Date: Thu, 7 Nov 2024 14:02:57 +0100 Subject: [PATCH] migrate to github actions --- .github/workflows/release-dapp-esealing.yaml | 14 +++++ .github/workflows/release-dapp-voting.yaml | 14 +++++ .github/workflows/release-dapp-wccd.yaml | 56 ++++++++++++++++++++ examples/eSealing/Dockerfile | 15 +++--- examples/voting/Dockerfile | 15 +++--- examples/wCCD/Dockerfile | 15 +++--- 6 files changed, 108 insertions(+), 21 deletions(-) create mode 100644 .github/workflows/release-dapp-esealing.yaml create mode 100644 .github/workflows/release-dapp-voting.yaml create mode 100644 .github/workflows/release-dapp-wccd.yaml diff --git a/.github/workflows/release-dapp-esealing.yaml b/.github/workflows/release-dapp-esealing.yaml new file mode 100644 index 000000000..8e724e31b --- /dev/null +++ b/.github/workflows/release-dapp-esealing.yaml @@ -0,0 +1,14 @@ +on: + push: + tags: + - dapp-esealing/* + +jobs: + release-base-image: + uses: concordium/.github/.github/workflows/docker-release-workflow.yaml@v1 + with: + SERVICE_NAME: "dapp-esealing" + BUILD_ARGS: | + base_image=node:18-slim + DOCKER_FILE_PATH: examples/eSealing + secrets: inherit diff --git a/.github/workflows/release-dapp-voting.yaml b/.github/workflows/release-dapp-voting.yaml new file mode 100644 index 000000000..790d9333e --- /dev/null +++ b/.github/workflows/release-dapp-voting.yaml @@ -0,0 +1,14 @@ +on: + push: + tags: + - dapp-voting/* + +jobs: + release-base-image: + uses: concordium/.github/.github/workflows/docker-release-workflow.yaml@v1 + with: + SERVICE_NAME: "dapp-voting" + BUILD_ARGS: | + base_image=node:18-slim + DOCKER_FILE_PATH: examples/voting + secrets: inherit diff --git a/.github/workflows/release-dapp-wccd.yaml b/.github/workflows/release-dapp-wccd.yaml new file mode 100644 index 000000000..4d1886bb4 --- /dev/null +++ b/.github/workflows/release-dapp-wccd.yaml @@ -0,0 +1,56 @@ +on: + push: + tags: + - dapp-wccd/* + +env: + BASE_IMAGE: "node:18-slim" + +jobs: + release-docker: + runs-on: ubuntu-latest + environment: release + strategy: + fail-fast: false + matrix: + env: + - "testnet" + - "mainnet" + steps: + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: 'concordium' + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Clone repo + uses: actions/checkout@v4 + + - name: Set image tag if correctly formatted + env: + TAG: ${{ github.ref_name }} + run: | + TAG_VERSION=${{ matrix.env }}-${TAG##${{ inputs.SERVICE_NAME }}/} + echo "FULL_IMAGE_TAG=concordium/${{ inputs.SERVICE_NAME }}:${TAG_VERSION}" >> $GITHUB_ENV + + - name: Check if image exist + run: | + set +e + docker manifest inspect ${{ env.FULL_IMAGE_TAG }} + EXITCODE=$? + if [ $EXITCODE -eq "0" ]; then + echo "Error: ${{ env.FULL_IMAGE_TAG }} already exist" + exit 1 + fi + + - name: Build Docker Image + uses: docker/build-push-action@v6 + with: + context: . + file: ./examples/wCCD/Dockerfile + tags: ${{ env.FULL_IMAGE_TAG }} + no-cache: true + push: true + build-args: | + base_image=${{ env.BASE_IMAGE }} + NETWORK=${{ matrix.env }} diff --git a/examples/eSealing/Dockerfile b/examples/eSealing/Dockerfile index 6a12fcad3..f066f905e 100644 --- a/examples/eSealing/Dockerfile +++ b/examples/eSealing/Dockerfile @@ -3,16 +3,17 @@ ARG base_image=node:18-slim FROM ${base_image} AS build WORKDIR /app -COPY ./package.json ./package.json -COPY ./tsconfig.json ./tsconfig.json -COPY ./index.html ./ -COPY ./vite.config.ts ./ -COPY ./public ./public -COPY ./src ./src +COPY ./examples/eSealing/package.json ./package.json +COPY ./examples/eSealing/tsconfig.json ./tsconfig.json +COPY ./examples/eSealing/index.html ./ +COPY ./examples/eSealing/vite.config.ts ./ +COPY ./examples/eSealing/public ./public +COPY ./examples/eSealing/src ./src RUN yarn && yarn cache clean RUN yarn build FROM nginx +LABEL build_image="${build_image}" COPY --from=build ./app/dist ./usr/share/nginx/html -COPY ./nginx.conf /etc/nginx/conf.d/default.conf +COPY ./examples/eSealing/nginx.conf /etc/nginx/conf.d/default.conf diff --git a/examples/voting/Dockerfile b/examples/voting/Dockerfile index 6a12fcad3..e645d3a80 100644 --- a/examples/voting/Dockerfile +++ b/examples/voting/Dockerfile @@ -3,16 +3,17 @@ ARG base_image=node:18-slim FROM ${base_image} AS build WORKDIR /app -COPY ./package.json ./package.json -COPY ./tsconfig.json ./tsconfig.json -COPY ./index.html ./ -COPY ./vite.config.ts ./ -COPY ./public ./public -COPY ./src ./src +COPY ./examples/voting/package.json ./package.json +COPY ./examples/voting/tsconfig.json ./tsconfig.json +COPY ./examples/voting/index.html ./ +COPY ./examples/voting/vite.config.ts ./ +COPY ./examples/voting/public ./public +COPY ./examples/voting/src ./src RUN yarn && yarn cache clean RUN yarn build FROM nginx +LABEL build_image="${build_image}" COPY --from=build ./app/dist ./usr/share/nginx/html -COPY ./nginx.conf /etc/nginx/conf.d/default.conf +COPY ./examples/voting/nginx.conf /etc/nginx/conf.d/default.conf diff --git a/examples/wCCD/Dockerfile b/examples/wCCD/Dockerfile index fac0d47d5..ea6715ae3 100644 --- a/examples/wCCD/Dockerfile +++ b/examples/wCCD/Dockerfile @@ -3,12 +3,12 @@ ARG base_image=node:18-slim FROM ${base_image} AS build WORKDIR /app -COPY ./package.json ./package.json -COPY ./tsconfig.json ./tsconfig.json -COPY ./index.html ./ -COPY ./vite.config.ts ./ -COPY ./public ./public -COPY ./src ./src +COPY ./examples/wCCD/package.json ./package.json +COPY ./examples/wCCD/tsconfig.json ./tsconfig.json +COPY ./examples/wCCD/index.html ./ +COPY ./examples/wCCD/vite.config.ts ./ +COPY ./examples/wCCD/public ./public +COPY ./examples/wCCD/src ./src RUN yarn && yarn cache clean @@ -18,5 +18,6 @@ RUN if [ "$NETWORK" = "testnet" ]; then yarn build; fi RUN if [ "$NETWORK" = "mainnet" ]; then yarn build-prod; fi FROM nginx +LABEL build_image="${build_image}" COPY --from=build ./app/dist ./usr/share/nginx/html -COPY ./nginx.conf /etc/nginx/conf.d/default.conf +COPY ./examples/wCCD/nginx.conf /etc/nginx/conf.d/default.conf