From d9ecc5e2ca5639bde4ac7a72d1259af4a5f68467 Mon Sep 17 00:00:00 2001 From: Oscar Eriksson Date: Tue, 26 Mar 2024 19:54:01 +0100 Subject: [PATCH] Add Github workflows to automatically build docker images (#28) * Add Github workflows to automatically build docker images * Add workflow for cli container --- .github/workflows/cli.yml | 31 ++++++++++++++++++++++++++++++ .github/workflows/web-backend.yml | 31 ++++++++++++++++++++++++++++++ .github/workflows/web-frontend.yml | 31 ++++++++++++++++++++++++++++++ 3 files changed, 93 insertions(+) create mode 100644 .github/workflows/cli.yml create mode 100644 .github/workflows/web-backend.yml create mode 100644 .github/workflows/web-frontend.yml diff --git a/.github/workflows/cli.yml b/.github/workflows/cli.yml new file mode 100644 index 0000000..d7ec45f --- /dev/null +++ b/.github/workflows/cli.yml @@ -0,0 +1,31 @@ +name: Build cli tool + +on: + push: + branches: [master] + pull_request: + branches: [master] + +jobs: + build: + name: Build docker container + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to GitHub Container Registry + if: ${{ github.ref == 'refs/heads/master' }} + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build Docker image (and push on master) + uses: docker/build-push-action@v4.0.0 + with: + push: ${{ github.ref == 'refs/heads/master' }} + tags: ghcr.io/cthit/goldapps-cli:latest + file: ./Dockerfile diff --git a/.github/workflows/web-backend.yml b/.github/workflows/web-backend.yml new file mode 100644 index 0000000..8688636 --- /dev/null +++ b/.github/workflows/web-backend.yml @@ -0,0 +1,31 @@ +name: Build web backend + +on: + push: + branches: [master] + pull_request: + branches: [master] + +jobs: + build: + name: Build docker container + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to GitHub Container Registry + if: ${{ github.ref == 'refs/heads/master' }} + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build Docker image (and push on master) + uses: docker/build-push-action@v4.0.0 + with: + push: ${{ github.ref == 'refs/heads/master' }} + tags: ghcr.io/cthit/goldapps-web-backend:latest + file: ./Dockerfile.web diff --git a/.github/workflows/web-frontend.yml b/.github/workflows/web-frontend.yml new file mode 100644 index 0000000..c711894 --- /dev/null +++ b/.github/workflows/web-frontend.yml @@ -0,0 +1,31 @@ +name: Build web frontend + +on: + push: + branches: [master] + pull_request: + branches: [master] + +jobs: + build: + name: Build docker container + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to GitHub Container Registry + if: ${{ github.ref == 'refs/heads/master' }} + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build Docker image (and push on master) + uses: docker/build-push-action@v4.0.0 + with: + push: ${{ github.ref == 'refs/heads/master' }} + tags: ghcr.io/cthit/goldapps-web-frontend:latest + context: frontend