-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Dockerfile-api
36 lines (25 loc) · 1.04 KB
/
Dockerfile-api
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
FROM python:3.12-alpine
LABEL org.opencontainers.image.source https://github.com/openzim/zimit-frontend
# Specifying a workdir which is not "/"" is mandatory for proper uvicorn watchfiles
# operation (used mostly only in dev, but changing the workdir does not harm production)
WORKDIR "/home"
# Install necessary packages (only pip so far)
RUN python -m pip install --no-cache-dir -U \
pip
# Set to your client origin(s)
ENV ALLOWED_ORIGINS http://localhost:8001|http://127.0.0.1:8001
# Copy minimal files for installation of project dependencies
COPY api/pyproject.toml api/README.md /src/
COPY api/src/zimitfrontend/__about__.py /src/src/zimitfrontend/__about__.py
# Install project dependencies
RUN pip install --no-cache-dir /src
# Copy code + associated artifacts
COPY api/src /src/src
COPY api/*.md /src/
# Install project + cleanup afterwards
RUN pip install --no-cache-dir /src \
&& rm -rf /src
ENV LOCALES_LOCATION /locales
COPY locales /locales
EXPOSE 80
CMD ["uvicorn", "zimitfrontend.entrypoint:app", "--host", "0.0.0.0", "--port", "80"]