Skip to content

Commit

Permalink
migrate to github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
lassemand committed Nov 7, 2024
1 parent 551852e commit 56c758a
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 21 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/release-dapp-esealing.yaml
Original file line number Diff line number Diff line change
@@ -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
14 changes: 14 additions & 0 deletions .github/workflows/release-dapp-voting.yaml
Original file line number Diff line number Diff line change
@@ -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
56 changes: 56 additions & 0 deletions .github/workflows/release-dapp-wccd.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
15 changes: 8 additions & 7 deletions examples/eSealing/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
15 changes: 8 additions & 7 deletions examples/voting/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
15 changes: 8 additions & 7 deletions examples/wCCD/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

0 comments on commit 56c758a

Please sign in to comment.