-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
32 lines (22 loc) · 908 Bytes
/
Copy pathDockerfile
File metadata and controls
32 lines (22 loc) · 908 Bytes
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
# Stage 1 — builder: install dependencies into an in-project venv
FROM python:3.13-slim AS builder
WORKDIR /app
RUN pip install uv --no-cache-dir
COPY pyproject.toml uv.lock ./
# Install only dependencies (skip installing the package itself — source is copied in runtime stage)
RUN uv sync --extra ui --no-dev --frozen --no-install-project
# Stage 2 — runtime: copy venv + source only (no uv, no build tools)
FROM python:3.13-slim
RUN useradd --create-home app && mkdir /app && chown app:app /app
WORKDIR /app
COPY --from=builder /app/.venv /app/.venv
COPY --chown=app:app expense_analyzer/ expense_analyzer/
RUN mkdir /data && chown app:app /data
USER app
ENV PATH="/app/.venv/bin:$PATH"
ENV PYTHONPATH=/app
ENV EXPENSE_ANALYZER_DB=/data/expense-analyzer.db
VOLUME /data
EXPOSE 8501
CMD ["streamlit", "run", "expense_analyzer/ui.py", \
"--server.port=8501", "--server.address=0.0.0.0"]