-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.prod
27 lines (21 loc) · 1.12 KB
/
Dockerfile.prod
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
FROM python:3.12.7-alpine3.20@sha256:5049c050bdc68575a10bcb1885baa0689b6c15152d8a56a7e399fb49f783bf98
WORKDIR /inventory-management-system-api-run
# Requirement when using a different workdir to get scripts to import correctly
ENV PYTHONPATH="${PYTHONPATH}:/inventory-management-system-api-run"
COPY README.md pyproject.toml ./
# Copy inventory_management_system_api source files
COPY inventory_management_system_api/ inventory_management_system_api/
RUN set -eux; \
\
# Install pip dependencies \
python -m pip install --no-cache-dir .; \
\
# Create loging.ini from its .example file \
cp inventory_management_system_api/logging.example.ini inventory_management_system_api/logging.ini; \
\
# Create a non-root user to run as \
addgroup -S inventory-management-system-api; \
adduser -S -D -G inventory-management-system-api -H -h /inventory-management-system-api-run inventory-management-system-api;
USER inventory-management-system-api
CMD ["uvicorn", "inventory_management_system_api.main:app", "--app-dir", "/inventory-management-system-api-run", "--host", "0.0.0.0", "--port", "8000"]
EXPOSE 8000