From 52ccda5d1b1d0ee00466a1f879fc6e80771f12e3 Mon Sep 17 00:00:00 2001 From: Clemens Rudert Date: Mon, 7 Nov 2022 15:45:42 +0100 Subject: [PATCH] add new actions for build --- .github/workflows/docker-image-latest.yml | 88 +++++++++++++++++++++ .github/workflows/docker-image-nightly.yml | 92 ++++++++++++++++++++++ .github/workflows/docker-image-release.yml | 88 +++++++++++++++++++++ Dockerfile | 4 +- 4 files changed, 270 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/docker-image-latest.yml create mode 100644 .github/workflows/docker-image-nightly.yml create mode 100644 .github/workflows/docker-image-release.yml diff --git a/.github/workflows/docker-image-latest.yml b/.github/workflows/docker-image-latest.yml new file mode 100644 index 0000000..47923a2 --- /dev/null +++ b/.github/workflows/docker-image-latest.yml @@ -0,0 +1,88 @@ +name: Build and push latest + +on: + push: + branches: [ "master" ] + + +jobs: + + build-and-push-qwc2-minimal-base: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push mgdm2oereb-service + uses: docker/build-push-action@v3 + with: + context: ./ + push: true + tags: ghcr.io/${{ github.repository }}-qwc2-minimal-base:latest + target: qwc2_base + + build-and-push-qwc2-minimal-dev: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push mgdm2oereb-service + uses: docker/build-push-action@v3 + with: + context: ./mgdm2oereb_frontend + push: true + tags: ghcr.io/${{ github.repository }}-qwc2-minimal-dev:latest + target: dev + + build-and-push-qwc2-minimal-builder: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push mgdm2oereb-service + uses: docker/build-push-action@v3 + with: + context: ./mgdm2oereb_frontend + push: true + tags: ghcr.io/${{ github.repository }}-qwc2-minimal-builder:latest + target: builder + + build-and-push-qwc2-minimal-prod: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push mgdm2oereb-service + uses: docker/build-push-action@v3 + with: + context: ./mgdm2oereb_frontend + push: true + tags: ghcr.io/${{ github.repository }}-qwc2-minimal-prod:latest + target: prod diff --git a/.github/workflows/docker-image-nightly.yml b/.github/workflows/docker-image-nightly.yml new file mode 100644 index 0000000..61b45bc --- /dev/null +++ b/.github/workflows/docker-image-nightly.yml @@ -0,0 +1,92 @@ +name: Build and push nightly + +on: + pull_request: + branches: [ "master" ] + + +jobs: + + build-and-push-qwc2-minimal-base: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push mgdm2oereb-service + uses: docker/build-push-action@v3 + with: + context: ./ + # do not push for the moment, to avoid load + # push: true + tags: ghcr.io/${{ github.repository }}-qwc2-minimal-base:${{ github.head_ref }}-${{ github.sha }} + target: qwc2_base + + build-and-push-qwc2-minimal-dev: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push mgdm2oereb-service + uses: docker/build-push-action@v3 + with: + context: ./mgdm2oereb_frontend + # do not push for the moment, to avoid load + # push: true + tags: ghcr.io/${{ github.repository }}-qwc2-minimal-dev:${{ github.head_ref }}-${{ github.sha }} + target: dev + + build-and-push-qwc2-minimal-builder: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push mgdm2oereb-service + uses: docker/build-push-action@v3 + with: + context: ./mgdm2oereb_frontend + # do not push for the moment, to avoid load + # push: true + tags: ghcr.io/${{ github.repository }}-qwc2-minimal-builder:${{ github.head_ref }}-${{ github.sha }} + target: builder + + build-and-push-qwc2-minimal-prod: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push mgdm2oereb-service + uses: docker/build-push-action@v3 + with: + context: ./mgdm2oereb_frontend + # do not push for the moment, to avoid load + # push: true + tags: ghcr.io/${{ github.repository }}-qwc2-minimal-prod:${{ github.head_ref }}-${{ github.sha }} + target: prod diff --git a/.github/workflows/docker-image-release.yml b/.github/workflows/docker-image-release.yml new file mode 100644 index 0000000..95facda --- /dev/null +++ b/.github/workflows/docker-image-release.yml @@ -0,0 +1,88 @@ +name: Build and push tag + +on: + push: + tags: [ "*" ] + + +jobs: + + build-and-push-qwc2-minimal-base: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push mgdm2oereb-service + uses: docker/build-push-action@v3 + with: + context: ./ + push: true + tags: ghcr.io/${{ github.repository }}-qwc2-minimal-base:${{ github.ref_name }} + target: qwc2_base + + build-and-push-qwc2-minimal-dev: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push mgdm2oereb-service + uses: docker/build-push-action@v3 + with: + context: ./mgdm2oereb_frontend + push: true + tags: ghcr.io/${{ github.repository }}-qwc2-minimal-dev:${{ github.ref_name }} + target: dev + + build-and-push-qwc2-minimal-builder: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push mgdm2oereb-service + uses: docker/build-push-action@v3 + with: + context: ./mgdm2oereb_frontend + push: true + tags: ghcr.io/${{ github.repository }}-qwc2-minimal-builder:${{ github.ref_name }} + target: builder + + build-and-push-qwc2-minimal-prod: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push mgdm2oereb-service + uses: docker/build-push-action@v3 + with: + context: ./mgdm2oereb_frontend + push: true + tags: ghcr.io/${{ github.repository }}-qwc2-minimal-prod:${{ github.ref_name }} + target: prod diff --git a/Dockerfile b/Dockerfile index 0fc8dc6..1c97f7c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ ARG NODE_VERSION="18.10" -FROM node:${NODE_VERSION} as qwc2_base +FROM node:${NODE_VERSION} as base ARG QWC2_VERSION_HASH="86ba224001cd3c9813ad645f4ccf4de7a17db801" ARG QWC2_DOWNLOAD_PATH="https://github.com/qgis/qwc2/archive/$QWC2_VERSION_HASH.zip" @@ -19,7 +19,7 @@ WORKDIR /qwc2 RUN yarn install -FROM qwc2_base as dev +FROM base as dev ENV DEV_SERVER_PORT=8080