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 diff --git a/.github/workflows/deploy-production.yml b/.github/workflows/deploy-production.yml index 4629c4406..7c094b28e 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,19 +19,29 @@ 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: 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 + - name: Build image and push it to the container repository uses: docker/build-push-action@v4 with: 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 + + deploy: + needs: build + runs-on: ubuntu-latest # Run the job on an Ubuntu runner + steps: + - name: Call Watchtower to Update Docker Image + run: | + curl -I --fail-with-body \ + -H "Authorization: Bearer ${{ secrets.WATCHTOWER_TOKEN }}" \ + ${{ vars.WATCHTOWER_URL }} diff --git a/.github/workflows/deploy-test.yml b/.github/workflows/deploy-test.yml index f594b83f2..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: @@ -15,19 +15,29 @@ 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: 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 + - name: Build image and push it to the container registry uses: docker/build-push-action@v4 with: 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 + + deploy: + needs: build + runs-on: ubuntu-latest # Run the job on an Ubuntu runner + steps: + - name: Call Watchtower to Update Docker Image + run: | + curl -I --fail-with-body \ + -H "Authorization: Bearer ${{ secrets.WATCHTOWER_TOKEN }}" \ + ${{ vars.WATCHTOWER_URL }}