Skip to content

게임 방 생성 rest API (#28) #21

게임 방 생성 rest API (#28)

게임 방 생성 rest API (#28) #21

Workflow file for this run

name: backend-dev
on:
push:
branches: ['main']
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 tag only)
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: |
ghcr.io/modern-agile-team/quizz-game-io-backend:latest
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: Run Prisma migrate before starting app
run: |
docker run --rm \
--network quizzes_game_io_backend_default \
--env-file /home/github-runner/app/.env \
ghcr.io/modern-agile-team/quizz-game-io-backend:latest \
npx prisma migrate deploy
- 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" \
--network quizzes_game_io_backend_default \
-p 127.0.0.1:8080:8080 \
"$IMAGE"
- name: Prune dangling images (safe)
run: |
docker image prune -f