-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathDockerfile
More file actions
37 lines (30 loc) · 999 Bytes
/
Dockerfile
File metadata and controls
37 lines (30 loc) · 999 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
33
34
35
36
37
# Build stage
FROM python:3.13.7-alpine as install
# Install build dependencies, git, and pipx.
# Some Python packages may need to be compiled from source on Alpine/musl.
RUN apk add --no-cache build-base git pipx
RUN pipx install uv
ENV PATH="/root/.local/bin:${PATH}"
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
COPY pyproject.toml uv.lock feedmixer_api.py feedmixer_wsgi.py feedmixer.py /app/
COPY test /app/test
WORKDIR /app/
# Create virtual env, install dependencies, run tests, and then remove pycache files to save space.
RUN uv venv && \
uv sync --dev && \
uv pip install gunicorn && \
.venv/bin/python -m unittest discover test/unit && \
rm -rf test/ && \
find /app/.venv -type d -name __pycache__ -exec rm -rf {} +
# Final stage
FROM python:3.13.7-alpine
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
COPY --from=install /app/ /app
RUN chown -R nobody /app/
WORKDIR /app/
ENV PATH="/app/.venv/bin/:$PATH"
USER nobody
ENTRYPOINT ["gunicorn"]
CMD ["-b", ":8000", "feedmixer_wsgi"]