-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.auth
41 lines (32 loc) · 1.56 KB
/
Dockerfile.auth
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
FROM python:3.12-slim AS build-env
WORKDIR /app
ENV WORKDIR "/app"
COPY ./auth_api/src/requirements.txt requirements.txt
RUN pip install --upgrade pip \
&& pip install -r ${WORKDIR}/requirements.txt \
&& mkdir -p ${WORKDIR}/logs
# FROM gcr.io/distroless/python3
# I can't use distroless now because an image is old:
# It has a bug in pydantic:
# ModuleNotFoundError: No module named 'pydantic_core._pydantic_core'
# It can be used with python3.11 but my code works only with 3.12.
# WORKDIR /app
ENV WORKDIR "/app"
ENV LOG_ENV "prod"
ENV LOG_LEVEL "debug"
ENV PRIVATE_KEY_FILEPATH "${WORKDIR}/keys/private_key.pem"
ENV PUBLIC_KEY_FILEPATH "${WORKDIR}/keys/public_key.pem"
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ENV PYTHONPATH "${PYTHONPATH}:${WORKDIR}"
#ENV PYTHONPATH "${PYTHONPATH}:${WORKDIR}:/usr/local/lib/python3.11/site-packages"
#COPY --from=build-env /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
#COPY --from=build-env /usr/local/bin/gunicorn /usr/local/bin/gunicorn
#COPY --from=build-env ${WORKDIR}/logs ${WORKDIR}/logs
COPY ./auth_api/src ./auth_api/src
COPY ./auth_app ./auth_app
COPY ./db ./db
COPY ./project_settings ./project_settings
COPY ./helpers ./helpers
CMD ["/bin/sh", "-c", "gunicorn -k uvicorn.workers.UvicornWorker --logger-class=auth_api.src.core.config.GunicornLogger --log-level DEBUG --bind 0.0.0.0:8000 auth_api.src.main:app"]
#CMD ["/usr/local/bin/gunicorn", "-k=uvicorn.workers.UvicornWorker", "--logger-class=auth_api.src.core.config.GunicornLogger", "--bind=0.0.0.0:8000", "auth_api.src.main:app"]