-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
48 lines (35 loc) · 1.11 KB
/
Dockerfile
File metadata and controls
48 lines (35 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
FROM python:3.14-slim
ARG APP_VERSION=dev
ENV APP_VERSION=${APP_VERSION}
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*
# Install uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
# Copy dependency files
COPY backend/pyproject.toml backend/uv.lock ./
# Install dependencies using locked versions
RUN uv sync --frozen --no-dev --no-install-project
# Copy application code
COPY backend/src/ ./src/
COPY backend/alembic/ ./alembic/
COPY backend/alembic.ini ./
COPY backend/seed.py ./
# Install the project itself
RUN uv sync --frozen --no-dev
# Expose port
EXPOSE 8000
# Copy entrypoint
COPY backend/entrypoint.sh ./entrypoint.sh
RUN chmod +x entrypoint.sh
# Run as non-root user
RUN addgroup --system --gid 1001 appuser && adduser --system --uid 1001 --ingroup appuser appuser
RUN chown -R appuser:appuser /app
ENV UV_CACHE_DIR=/app/.cache/uv
USER appuser
ENTRYPOINT ["./entrypoint.sh"]
# Run the application
CMD ["uv", "run", "uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "8000"]