Skip to content

Commit 2ff0b48

Browse files
author
Kevin Allioli
committed
Upgrade to Python 3.13 and Alpine base image with multi-stage build
1 parent 0b0090d commit 2ff0b48

4 files changed

Lines changed: 23 additions & 16 deletions

File tree

β€Ž.github/workflows/docs.ymlβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626

2727
- uses: actions/setup-python@v5
2828
with:
29-
python-version: "3.12"
29+
python-version: "3.13"
3030

3131
- name: Install MkDocs + Material
3232
run: |

β€Ž.github/workflows/release.ymlβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323

2424
- uses: actions/setup-python@v5
2525
with:
26-
python-version: "3.12"
26+
python-version: "3.13"
2727

2828
- name: Install dependencies
2929
run: pip install -r requirements.txt cryptography pytest pytest-asyncio httpx
@@ -73,7 +73,7 @@ jobs:
7373

7474
- uses: actions/setup-python@v5
7575
with:
76-
python-version: "3.12"
76+
python-version: "3.13"
7777

7878
- name: Build package
7979
run: pip install build && python -m build cli/

β€ŽDockerfileβ€Ž

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
1-
FROM python:3.12-slim
1+
# ── Stage 1: build dependencies ──────────────────────────────────────────────
2+
FROM python:3.13-alpine AS builder
3+
4+
# Build deps needed to compile cryptography (Rust/C) and other native packages
5+
RUN apk add --no-cache gcc musl-dev libffi-dev openssl-dev cargo
6+
7+
WORKDIR /build
8+
9+
COPY requirements.txt .
10+
RUN pip install --no-cache-dir --prefix=/install -r requirements.txt
11+
12+
13+
# ── Stage 2: runtime image ────────────────────────────────────────────────────
14+
FROM python:3.13-alpine
215

316
# ── OCI image annotations ─────────────────────────────────────────────────────
417
LABEL org.opencontainers.image.title="Ghostbit" \
@@ -9,29 +22,22 @@ LABEL org.opencontainers.image.title="Ghostbit" \
922
org.opencontainers.image.vendor="StackOps HQ" \
1023
org.opencontainers.image.licenses="MIT"
1124

12-
WORKDIR /app
25+
# Runtime deps only (no compiler, no Rust, no build tools)
26+
RUN apk add --no-cache libffi openssl
1327

14-
COPY requirements.txt .
15-
RUN pip install --no-cache-dir -r requirements.txt
28+
# Copy installed packages from builder
29+
COPY --from=builder /install /usr/local
1630

31+
WORKDIR /app
1732
COPY . .
1833

1934
RUN mkdir -p /data
2035

2136
# ── Runtime configuration ─────────────────────────────────────────────────────
22-
# Storage backend: "sqlite" or "redis"
2337
ENV STORAGE_BACKEND=sqlite
24-
25-
# SQLite database path (only used when STORAGE_BACKEND=sqlite)
2638
ENV SQLITE_PATH=/data/ghostbit.db
27-
28-
# Redis connection URL (only used when STORAGE_BACKEND=redis)
2939
ENV REDIS_URL=redis://localhost:6379
30-
31-
# Maximum paste size in bytes (default: 512 KB)
3240
ENV MAX_PASTE_SIZE=524288
33-
34-
# Server port
3541
ENV PORT=8000
3642

3743
EXPOSE ${PORT}

β€Žcli/pyproject.tomlβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ classifiers = [
2222
"Programming Language :: Python :: 3.10",
2323
"Programming Language :: Python :: 3.11",
2424
"Programming Language :: Python :: 3.12",
25+
"Programming Language :: Python :: 3.13",
2526
"Topic :: Internet",
2627
"Topic :: Security :: Cryptography",
2728
"Topic :: Utilities",

0 commit comments

Comments
Β (0)