From 2bace783af0794c0b5c06905393b9d35b6290e88 Mon Sep 17 00:00:00 2001 From: heki Date: Sun, 17 May 2026 05:05:42 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20Docker=E3=82=A4=E3=83=A1=E3=83=BC?= =?UTF-8?q?=E3=82=B8=E3=83=93=E3=83=AB=E3=83=89=E3=81=A8VPS=E8=87=AA?= =?UTF-8?q?=E5=8B=95=E3=83=87=E3=83=97=E3=83=AD=E3=82=A4=E3=81=AECI/CD?= =?UTF-8?q?=E3=83=91=E3=82=A4=E3=83=97=E3=83=A9=E3=82=A4=E3=83=B3=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/deploy.yml | 53 ++++++++++++++++++++++++++++++++++++ Dockerfile | 23 ++++++++++++++++ docker-compose.yml | 5 ++++ 3 files changed, 81 insertions(+) create mode 100644 .github/workflows/deploy.yml create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..9ecdf79 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,53 @@ +name: Deploy + +on: + push: + branches: + - main + +jobs: + build-and-push: + runs-on: ubuntu-latest + outputs: + image: ${{ steps.meta.outputs.tags }} + steps: + - uses: actions/checkout@v4 + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Extract metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ secrets.DOCKERHUB_USERNAME }}/eq-muster + tags: | + type=sha,prefix=sha- + type=raw,value=latest + + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + + deploy: + needs: build-and-push + runs-on: ubuntu-latest + steps: + - name: Deploy to VPS + uses: appleboy/ssh-action@v1 + with: + host: ${{ secrets.VPS_HOST }} + username: root + key: ${{ secrets.VPS_SSH_KEY }} + script: | + set -e + cd /srv/eq-muster + docker compose pull + docker compose up -d + docker image prune -f diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..cc6250a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM python:3.14-slim AS builder + +COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv + +WORKDIR /app + +COPY pyproject.toml uv.lock ./ +RUN uv sync --frozen --no-dev --no-editable + +COPY src/ ./src/ +RUN uv sync --frozen --no-dev + + +FROM python:3.14-slim + +WORKDIR /app + +COPY --from=builder /app/.venv /app/.venv +COPY --from=builder /app/src /app/src + +ENV PATH="/app/.venv/bin:$PATH" + +CMD ["eq-muster"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..1667e61 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,5 @@ +services: + eq-muster: + image: heki0323/eq-muster:latest + restart: unless-stopped + env_file: .env