diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 6eff008..99fafb9 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -7,6 +7,7 @@ on: push: branches: - master + workflow_dispatch: jobs: ci: @@ -44,6 +45,8 @@ jobs: - ci steps: + - uses: actions/checkout@v4 + - name: Set up QEMU uses: docker/setup-qemu-action@v3 @@ -52,16 +55,34 @@ jobs: with: driver-opts: image=moby/buildkit:master - - name: Login to Github Packages + - name: Login to Github Container Registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.DOCKER_TOKEN }} - - name: Build and push app to GitHub Packages - uses: docker/build-push-action@v5 +# - name: Build and push app to GitHub Container Registry +# uses: docker/build-push-action@v5 +# with: +# file: Dockerfile +# push: true +# tags: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:latest + + - name: Set up Docker context + uses: amirmarmul/docker-context-ssh-action@v2 with: - file: Dockerfile - push: true - tags: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:latest + ssh-host: ${{ secrets.SSH_HOST }} + ssh-username: ${{ secrets.SSH_USER }} + ssh-private-key: ${{ secrets.SSH_KEY }} + context-name: cloud + context-use: true + + - name: Deploy application + env: + GHCR_USER: ${{ secrets.GHCR_TOKEN }} + GHCR_TOKEN: ${{ secrets.GHCR_TOKEN }} + COMPOSE_PROJECT_NAME: ${{ github.event.repository.name }} + run: | + docker-compose pull --quiet + docker-compose up --detach app diff --git a/docker-compose.yml b/docker-compose.yml index e2b81e3..b498df8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,18 +3,25 @@ version: "3.11" services: app: image: ghcr.io/floriandejonckheere/wattson:latest + networks: + - fcloud restart: unless-stopped labels: traefik.enable: "true" traefik.http.middlewares.wattson-tls.redirectscheme.scheme: "https" - traefik.http.routers.wattson.rule: "Host(`wattson.florian.dejonckhee.re`)" + traefik.http.routers.wattson.rule: "Host(`wattson.dejonckhee.re`)" traefik.http.routers.wattson.entrypoints: "web" traefik.http.routers.wattson.middlewares: "wattson-tls" - traefik.http.routers.wattson-tls.rule: "Host(`wattson.florian.dejonckhee.re`)" + traefik.http.routers.wattson-tls.rule: "Host(`wattson.dejonckhee.re`)" traefik.http.routers.wattson-tls.entrypoints: "websecure" traefik.http.routers.wattson-tls.tls: "true" traefik.http.routers.wattson-tls.tls.certresolver: "letsencrypt" - traefik.http.services.wattson.loadbalancer.server.port: "80" + traefik.http.services.wattson.loadbalancer.server.port: "8080" + +networks: + fcloud: + external: true + name: "fcloud_default" diff --git a/nginx.conf b/nginx.conf index 9404f8f..d85a316 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1,6 +1,5 @@ server { - listen 80; - listen [::]:80; + listen 8080; # CORS proxy location /api {