Skip to content

Commit 37b78ec

Browse files
committed
add dockerfile and workflow
1 parent b6ccd6b commit 37b78ec

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: build-and-push
2+
on:
3+
release:
4+
types: [published]
5+
workflow_dispatch:
6+
7+
env:
8+
DOCKER_IMAGE: rtuszik/tlacuilo
9+
10+
jobs:
11+
build-and-push:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v6.0.2
16+
17+
- name: Set up Docker Buildx
18+
uses: docker/setup-buildx-action@v3
19+
20+
- name: Login to GitHub Container Registry
21+
uses: docker/login-action@v3
22+
with:
23+
registry: ghcr.io
24+
username: ${{ github.repository_owner }}
25+
password: ${{ secrets.GITHUB_TOKEN }}
26+
27+
- name: Extract metadata (tags, labels) for Docker
28+
id: meta
29+
uses: docker/metadata-action@v5
30+
with:
31+
images: ${{ env.DOCKER_IMAGE }}
32+
tags: |
33+
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
34+
type=semver,pattern={{version}},enable=${{ github.event_name == 'release' }}
35+
type=semver,pattern={{major}}.{{minor}},enable=${{ github.event_name == 'release' }}
36+
type=ref,event=branch
37+
type=ref,event=pr
38+
type=sha,prefix=sha-
39+
40+
- name: Build and push
41+
id: docker_build
42+
uses: docker/build-push-action@v6
43+
with:
44+
context: .
45+
file: ./Dockerfile
46+
push: ${{ github.event_name != 'pull_request' }}
47+
tags: ${{ steps.meta.outputs.tags }}
48+
labels: ${{ steps.meta.outputs.labels }}
49+
cache-from: type=registry,ref=${{ env.DOCKER_IMAGE }}:buildcache
50+
cache-to: type=registry,ref=${{ env.DOCKER_IMAGE }}:buildcache,mode=max
51+
platforms: linux/amd64,linux/arm64
52+
53+
- name: Image digest
54+
run: echo ${{ steps.docker_build.outputs.digest }}

Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM python:3.13-slim
2+
3+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
4+
5+
COPY . /app
6+
7+
WORKDIR /app
8+
9+
RUN uv sync --frozen --no-cache
10+
11+
CMD ["/app/.venv/bin/fastapi", "run", "src/tlacuilo/api/routes.py", "--port", "8000", "--host", "0.0.0.0"]

0 commit comments

Comments
 (0)