Skip to content

Commit e53d6ea

Browse files
committed
service: add Docker setup files and configuration
1 parent e7809ba commit e53d6ea

File tree

5 files changed

+87
-0
lines changed

5 files changed

+87
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Publish Docker image to GHCR
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
7+
permissions:
8+
contents: read
9+
packages: write
10+
11+
env:
12+
REGISTRY: ghcr.io
13+
IMAGE_NAME: ${{ github.repository }}
14+
15+
jobs:
16+
build-and-push:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
23+
- name: Set up QEMU
24+
uses: docker/setup-qemu-action@v3
25+
26+
- name: Set up Docker Buildx
27+
uses: docker/setup-buildx-action@v3
28+
29+
- name: Log in to GHCR
30+
uses: docker/login-action@v3
31+
with:
32+
registry: ${{ env.REGISTRY }}
33+
username: ${{ github.actor }}
34+
password: ${{ secrets.GITHUB_TOKEN }}
35+
36+
- name: Extract metadata (tags, labels)
37+
id: meta
38+
uses: docker/metadata-action@v5
39+
with:
40+
images: ${{ env.REGISTRY }}/${{ github.repository }}
41+
tags: |
42+
type=raw,value=latest
43+
type=sha
44+
45+
- name: Build and push
46+
uses: docker/build-push-action@v6
47+
with:
48+
context: ./service
49+
push: true
50+
tags: ${{ steps.meta.outputs.tags }}
51+
labels: ${{ steps.meta.outputs.labels }}

docker-compose.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
services:
2+
backend:
3+
image: ghcr.io/vatger/vatger-plugin:latest
4+
ports:
5+
- "8000:8000"
6+
restart: unless-stopped

service/.dockerignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
**/__pycache__
2+
**/.venv
3+
**/.mypy_cache
4+
**/.pytest_cache
5+
**/.ruff_cache
6+
.git
7+
.env
8+
9+
# test & coverage artifacts
10+
tests/
11+
coverage.xml
12+
htmlcov/
13+
.pytest_cache/

service/.env.sample

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
MONGO_URI=
2+
MONGO_DATABASE=

service/Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM python:3.13-slim
2+
3+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
4+
5+
WORKDIR /app
6+
7+
COPY pyproject.toml uv.lock* ./
8+
9+
COPY . .
10+
11+
RUN uv pip install --system --no-cache .
12+
13+
EXPOSE 8000
14+
15+
CMD ["uv", "run", "uvicorn", "api.app:app", "--host", "0.0.0.0", "--port", "8000", "--app-dir", "src"]

0 commit comments

Comments
 (0)