Skip to content

change port 3000 to 8080 #11

change port 3000 to 8080

change port 3000 to 8080 #11

Workflow file for this run

name: backend-dev
on:
push:
branches: ['chore/cicd']
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push (latest + sha tag)
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: |
ghcr.io/modern-agile-team/quizz-game-io-backend:latest
ghcr.io/modern-agile-team/quizz-game-io-backend:sha-${{ github.sha }}
deploy:
needs: build-and-push
runs-on: [self-hosted, homelab]
permissions:
contents: read
packages: read
steps:
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Update app container only
env:
IMAGE: ghcr.io/modern-agile-team/quizz-game-io-backend:latest
NAME: quizzes_game_io_backend_app
ENV_FILE: /home/github-runner/app/.env
run: |
docker pull "$IMAGE"
docker rm -f "$NAME" || true
docker run -d \
--name "$NAME" \
--restart unless-stopped \
--env-file "$ENV_FILE" \
-p 127.0.0.1:8080:8080 \
"$IMAGE"
# - name: Health check
# run: curl -fsS http://127.0.0.1:3000/health