generated from alexk1919/fastapi-motor-mongo-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
31 lines (23 loc) · 871 Bytes
/
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
FROM python:3.11.2-slim
# RUN apt-get update \
# && apt-get upgrade -y \
# && apt-get install -y --no-install-recommends curl git build-essential python3-setuptools \
# && apt-get autoremove -y
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
RUN adduser --disabled-password --gecos '' appuser
WORKDIR /server
RUN pip install --upgrade pip
RUN pip install poetry
RUN apt-get update -y \
&& apt-get upgrade -y \
&& apt-get install -y gcc python3-dev
COPY pyproject.toml poetry.lock ./
RUN poetry export --without-hashes --without dev -f requirements.txt -o requirements.txt && \
chown appuser:appuser requirements.txt && \
pip install -r requirements.txt
USER appuser
COPY --chown=appuser:appuser start.sh /server/
COPY --chown=appuser:appuser app /server/app
RUN chmod +x /server/start.sh
ENTRYPOINT [ "/server/start.sh" ]