-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
39 lines (28 loc) · 1.04 KB
/
Dockerfile
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
FROM python:3.13 AS builder
WORKDIR /app
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=on \
PIP_DISABLE_PIP_VERSION_CHECK=on
COPY ./pyproject.toml ./poetry.lock ./
COPY ./src/bss_web_file_server/__init__.py ./src/bss_web_file_server/
RUN pip wheel --wheel-dir ./wheels .
FROM python:3.13-slim AS app
# Create a non-root user
RUN adduser --system --group --home /home/nonroot nonroot
ENV PATH="/home/nonroot/.local/bin:${PATH}"
USER nonroot:nonroot
WORKDIR /home/nonroot/app
COPY --from=builder /app ./
COPY ./src ./src
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=on \
PIP_DISABLE_PIP_VERSION_CHECK=on
RUN pip install --no-cache-dir ./wheels/*
ENV SERVER_BASE_PATH="/home/nonroot/assets"
CMD ["uvicorn", "src.bss_web_file_server.main:app", "--host", "0.0.0.0", "--port", "80"]
EXPOSE 80
LABEL org.opencontainers.image.source="https://github.com/BSStudio/bss-web-file-api"
LABEL org.opencontainers.image.description="BSS Web file API"
LABEL org.opencontainers.image.licenses="GPL-3.0"