Add production Docker deployment

This commit is contained in:
암냥 2026-09-02 00:22:24 +09:00
commit f1e0e67704
4 changed files with 73 additions and 0 deletions

39
Dockerfile Normal file
View file

@ -0,0 +1,39 @@
# syntax=docker/dockerfile:1
FROM --platform=$BUILDPLATFORM oven/bun:1.3.13-alpine AS frontend-builder
WORKDIR /app
COPY package.json bun.lock ./
RUN bun install --frozen-lockfile
COPY frontend ./frontend
COPY vite.config.js ./
RUN bun run build
FROM ghcr.io/astral-sh/uv:0.9.5-python3.12-bookworm-slim AS runtime
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
UV_COMPILE_BYTECODE=1 \
UV_LINK_MODE=copy \
PATH="/app/.venv/bin:$PATH"
WORKDIR /app
COPY pyproject.toml uv.lock ./
RUN uv sync --frozen --no-dev
RUN useradd --create-home --uid 10001 appuser
COPY --chown=appuser:appuser app.py ./
COPY --chown=appuser:appuser templates ./templates
COPY --chown=appuser:appuser static/assets ./static/assets
COPY --from=frontend-builder --chown=appuser:appuser /app/static/dist ./static/dist
USER appuser
EXPOSE 8000
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "--workers", "2", "--threads", "4", "--access-logfile", "-", "--error-logfile", "-", "app:app"]