-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
50 lines (37 loc) · 1.63 KB
/
Dockerfile
File metadata and controls
50 lines (37 loc) · 1.63 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
49
50
# -- Build stage --
FROM python:3.14-alpine AS builder
WORKDIR /build
RUN apk add --no-cache gcc musl-dev libffi-dev
COPY requirements.txt .
RUN python -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
RUN --mount=type=cache,target=/root/.cache/pip \
pip install --no-compile -r requirements.txt \
&& find /opt/venv -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null; \
find /opt/venv -type f -name "*.pyc" -delete 2>/dev/null; \
find /opt/venv -type f -name "*.pyo" -delete 2>/dev/null; \
find /opt/venv -type d -name "tests" -exec rm -rf {} + 2>/dev/null; \
find /opt/venv -type d -name "test" -exec rm -rf {} + 2>/dev/null; true
# -- Runtime stage --
FROM python:3.14-alpine
LABEL maintainer="Sergio Fernandez <9169332+GeiserX@users.noreply.github.com>"
LABEL org.opencontainers.image.description="CashPilot - Self-hosted passive income orchestrator"
LABEL org.opencontainers.image.url="https://github.com/GeiserX/CashPilot"
LABEL org.opencontainers.image.source="https://github.com/GeiserX/CashPilot"
LABEL org.opencontainers.image.licenses="GPL-3.0"
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PATH="/opt/venv/bin:$PATH"
RUN apk add --no-cache su-exec
COPY --from=builder /opt/venv /opt/venv
RUN adduser -D -u 1000 cashpilot \
&& mkdir -p /data && chown cashpilot:root /data
WORKDIR /app
COPY --chown=cashpilot:root app/ ./app/
COPY --chown=cashpilot:root services/ ./services/
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
VOLUME /data
EXPOSE 8080
ENTRYPOINT ["/entrypoint.sh"]
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8080", "--no-access-log"]