From 6a6c8ba4e3e1d032e9863edb0cf04cb70958b0cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Kope=C4=8Dek?= Date: Mon, 22 Jan 2024 19:45:39 +0100 Subject: [PATCH 1/5] chore: change build to GitHub Container Registry --- .github/workflows/deploy-production.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy-production.yml b/.github/workflows/deploy-production.yml index 4629c4406..8c11967a9 100644 --- a/.github/workflows/deploy-production.yml +++ b/.github/workflows/deploy-production.yml @@ -19,12 +19,12 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - - name: Login to docker.bosan.cz registry + - name: Login to Docker registry uses: docker/login-action@v2 with: - registry: docker.bosan.cz - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Build image and push it to the docker.bosan.cz repository uses: docker/build-push-action@v4 @@ -32,6 +32,6 @@ jobs: build-args: NG_CONFIGURATION=production push: true context: . - tags: "docker.bosan.cz/web:latest" + tags: "ghcr.io/bosancz/web:latest" cache-from: type=gha cache-to: type=gha,mode=max From 400300afdf963e83d3346421c30a4204f2020075 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Kope=C4=8Dek?= Date: Mon, 22 Jan 2024 19:51:03 +0100 Subject: [PATCH 2/5] chore: change test build to GitHub Container Registry --- .github/workflows/deploy-test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy-test.yml b/.github/workflows/deploy-test.yml index f594b83f2..1607ed895 100644 --- a/.github/workflows/deploy-test.yml +++ b/.github/workflows/deploy-test.yml @@ -18,9 +18,9 @@ jobs: - name: Login to docker.bosan.cz registry uses: docker/login-action@v2 with: - registry: docker.bosan.cz - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Build image and push it to the docker.bosan.cz repository uses: docker/build-push-action@v4 @@ -28,6 +28,6 @@ jobs: build-args: NG_CONFIGURATION=test push: true context: . - tags: "docker.bosan.cz/web:test" + tags: "ghcr.io/bosancz/web:test" cache-from: type=gha cache-to: type=gha,mode=max From 742c10304ca271b2da048e931c7b132847065dde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Kope=C4=8Dek?= Date: Mon, 22 Jan 2024 19:20:42 +0000 Subject: [PATCH 3/5] chore: add watchtower deploy call --- .github/workflows/deploy-production.yml | 18 +++++++++++++++--- .github/workflows/deploy-test.yml | 16 ++++++++++++++-- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy-production.yml b/.github/workflows/deploy-production.yml index 8c11967a9..6c4441bee 100644 --- a/.github/workflows/deploy-production.yml +++ b/.github/workflows/deploy-production.yml @@ -9,7 +9,7 @@ on: - ".github/workflows/deploy-production.yml" jobs: - build-docker: + build: name: Build and Push Docker Image runs-on: ubuntu-latest steps: @@ -19,14 +19,14 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - - name: Login to Docker registry + - name: Login to container registry uses: docker/login-action@v2 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Build image and push it to the docker.bosan.cz repository + - name: Build image and push it to the container repository uses: docker/build-push-action@v4 with: build-args: NG_CONFIGURATION=production @@ -35,3 +35,15 @@ jobs: tags: "ghcr.io/bosancz/web:latest" cache-from: type=gha cache-to: type=gha,mode=max + + deploy: + needs: build + runs-on: ubuntu-latest # Run the job on an Ubuntu runner + steps: + - name: Call Watchtower to Update Docker Image + run: | + curl -X POST "$WATCHTOWER_URL" \ + -H "Authorization: Bearer ${{ secrets.WATCHTOWER_TOKEN }}" \ + -H "Content-Type: application/json" + env: + WATCHTOWER_URL: ${{ secrets.WATCHTOWER_URL }} diff --git a/.github/workflows/deploy-test.yml b/.github/workflows/deploy-test.yml index 1607ed895..a781fd37d 100644 --- a/.github/workflows/deploy-test.yml +++ b/.github/workflows/deploy-test.yml @@ -15,14 +15,14 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - - name: Login to docker.bosan.cz registry + - name: Login to container registry uses: docker/login-action@v2 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Build image and push it to the docker.bosan.cz repository + - name: Build image and push it to the container registry uses: docker/build-push-action@v4 with: build-args: NG_CONFIGURATION=test @@ -31,3 +31,15 @@ jobs: tags: "ghcr.io/bosancz/web:test" cache-from: type=gha cache-to: type=gha,mode=max + + deploy: + needs: build + runs-on: ubuntu-latest # Run the job on an Ubuntu runner + steps: + - name: Call Watchtower to Update Docker Image + run: | + curl -X POST "$WATCHTOWER_URL" \ + -H "Authorization: Bearer ${{ secrets.WATCHTOWER_TOKEN }}" \ + -H "Content-Type: application/json" + env: + WATCHTOWER_URL: ${{ secrets.WATCHTOWER_URL }} From aeab7b62b055d7972c34e2897bd273ad2e5ee484 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Kope=C4=8Dek?= Date: Mon, 22 Jan 2024 21:22:07 +0100 Subject: [PATCH 4/5] fix: bad watchtower url (#590) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: bad watchtower url * chore: remove path limitation to test action --------- Co-authored-by: Martin Kopeček --- .github/workflows/deploy-production.yml | 6 ++---- .github/workflows/deploy-test.yml | 8 +++----- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/workflows/deploy-production.yml b/.github/workflows/deploy-production.yml index 6c4441bee..7c094b28e 100644 --- a/.github/workflows/deploy-production.yml +++ b/.github/workflows/deploy-production.yml @@ -42,8 +42,6 @@ jobs: steps: - name: Call Watchtower to Update Docker Image run: | - curl -X POST "$WATCHTOWER_URL" \ + curl -I --fail-with-body \ -H "Authorization: Bearer ${{ secrets.WATCHTOWER_TOKEN }}" \ - -H "Content-Type: application/json" - env: - WATCHTOWER_URL: ${{ secrets.WATCHTOWER_URL }} + ${{ vars.WATCHTOWER_URL }} diff --git a/.github/workflows/deploy-test.yml b/.github/workflows/deploy-test.yml index a781fd37d..a8f65e90b 100644 --- a/.github/workflows/deploy-test.yml +++ b/.github/workflows/deploy-test.yml @@ -5,7 +5,7 @@ on: types: [opened, reopened, ready_for_review, synchronize] jobs: - build-docker: + build: name: Build and Push Docker Image runs-on: ubuntu-latest steps: @@ -38,8 +38,6 @@ jobs: steps: - name: Call Watchtower to Update Docker Image run: | - curl -X POST "$WATCHTOWER_URL" \ + curl -I --fail-with-body \ -H "Authorization: Bearer ${{ secrets.WATCHTOWER_TOKEN }}" \ - -H "Content-Type: application/json" - env: - WATCHTOWER_URL: ${{ secrets.WATCHTOWER_URL }} + ${{ vars.WATCHTOWER_URL }} From 079aa9f69e41e7c7f1254ccb8a4967e59d0191c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Kope=C4=8Dek?= Date: Tue, 23 Jan 2024 13:28:58 +0000 Subject: [PATCH 5/5] chore: move devcontainer command to Dockerfile --- .devcontainer/Dockerfile | 4 +++- .devcontainer/docker-compose.yml | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 87744cdbc..c93ba042f 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -12,4 +12,6 @@ RUN apk add --no-cache alpine-sdk python3 RUN npm i -g @angular/cli @nestjs/cli # set up git -RUN git config --global --add safe.directory /workspace && git config --global core.autocrlf true \ No newline at end of file +RUN git config --global --add safe.directory /workspace && git config --global core.autocrlf true + +CMD /bin/sh -c "while sleep 1000; do :; done" \ No newline at end of file diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index e97858fd9..c19d5536c 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -1,8 +1,8 @@ +name: bosan_web_development + services: devcontainer: container_name: ${COMPOSE_PROJECT_NAME:-bosan-web-dev}-devcontainer build: "." - command: /bin/sh -c "while sleep 1000; do :; done" - user: node volumes: - ..:/workspace:cached