Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 47a8d0201e |
34
Dockerfile
34
Dockerfile
@@ -1,25 +1,35 @@
|
|||||||
FROM python:3.12-slim AS base
|
# --- Build stage ---
|
||||||
|
FROM python:3.12-slim AS builder
|
||||||
|
|
||||||
# Install uv
|
|
||||||
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy dependency files first for better layer caching
|
# Enable bytecode compilation for faster startup
|
||||||
|
ENV UV_COMPILE_BYTECODE=1
|
||||||
|
# Use copy mode (no hardlinks in containers)
|
||||||
|
ENV UV_LINK_MODE=copy
|
||||||
|
|
||||||
|
# Install dependencies first (cached if pyproject.toml unchanged)
|
||||||
COPY pyproject.toml uv.lock* ./
|
COPY pyproject.toml uv.lock* ./
|
||||||
|
RUN uv sync --no-dev --no-install-project --frozen
|
||||||
|
|
||||||
# Install dependencies
|
# Copy source and install project
|
||||||
RUN uv sync --no-dev --no-install-project
|
|
||||||
|
|
||||||
# Copy source code
|
|
||||||
COPY src/ ./src/
|
COPY src/ ./src/
|
||||||
|
RUN uv sync --no-dev --frozen
|
||||||
|
|
||||||
# Install the project itself
|
# --- Runtime stage ---
|
||||||
RUN uv sync --no-dev
|
FROM python:3.12-slim
|
||||||
|
|
||||||
# Create data directory
|
WORKDIR /app
|
||||||
RUN mkdir -p /app/data
|
|
||||||
|
|
||||||
|
# Copy the entire venv and project from builder
|
||||||
|
COPY --from=builder /app /app
|
||||||
|
|
||||||
|
# Add venv to PATH so we don't need uv at runtime
|
||||||
|
ENV PATH="/app/.venv/bin:$PATH"
|
||||||
ENV DATA_DIR=/app/data
|
ENV DATA_DIR=/app/data
|
||||||
|
|
||||||
CMD ["uv", "run", "python", "-m", "src.main"]
|
RUN mkdir -p /app/data
|
||||||
|
|
||||||
|
CMD ["rss-bot"]
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
services:
|
services:
|
||||||
rss-bot:
|
rss-bot:
|
||||||
build: .
|
image: git.out.jafre.li/jafreli/updater:latest
|
||||||
container_name: rss-discord-bot
|
container_name: rss-discord-bot
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
env_file:
|
env_file:
|
||||||
|
|||||||
Reference in New Issue
Block a user