-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDockerfile.api
35 lines (25 loc) · 1014 Bytes
/
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
FROM python:3.10.10-slim-bullseye
ENV PYTHONDONTWRITEBYTECODE=1
# LANG must be C.UTF-8 for correct python UTF-8 support (note: cs_CZ.UTF-8 doesn't work!)
ENV PYTHONIOENCODING=utf-8
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
ENV VIRTUAL_ENV=/home/chatbot_fastapi/.venv
RUN python -m venv $VIRTUAL_ENV
ENV PATH "$VIRTUAL_ENV/bin:$PATH"
ENV PYTHONPATH /home/chatbot_fastapi/app/:${PYTHONPATH}
WORKDIR /home/chatbot_fastapi
# Copy and install python packages
COPY requirements.txt /home/chatbot_fastapi/
ENV USER=chatbot_fastapi
# Add user because of correct rights in openshift
RUN adduser --uid 73826 --no-create-home --ingroup root --disabled-password --gecos "" ${USER} \
&& chown -R ${USER}:root /home/chatbot_fastapi \
&& chmod -R 770 /home/chatbot_fastapi
USER ${USER}
RUN python -m pip install --upgrade pip
RUN pip install --no-cache-dir -r /home/chatbot_fastapi/requirements.txt
COPY --chown=${USER}:root . /home/chatbot_fastapi/
RUN ["chmod", "+x", "./api_starter.sh"]
# Run APP
CMD ./api_starter.sh