-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
45 lines (36 loc) · 1.08 KB
/
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
32
33
34
35
36
37
38
39
40
41
42
43
44
FROM python:3.10-slim
WORKDIR /usr/src/app
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ARG APP_USER=starterapi
ENV POETRY_VERSION=1.5.0 \
POETRY_HOME="/opt/poetry" \
POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=true \
POETRY_VIRTUALENVS_CREATE=false \
#app
APP_HOME="/usr/src/app" \
VENV_PATH="/usr/src/app/.venv"
RUN apt-get update && \
apt-get install -y \
netcat-traditional \
curl \
postgresql \
gcc \
python3-dev \
python3-pytest \
libc6 \
gnupg
RUN mkdir -p ${APP_HOME} ${POETRY_HOME} ${VENV_PATH} && \
useradd -m -u 8888 --no-log-init ${APP_USER} && \
chown -R ${APP_USER}:${APP_USER} ${POETRY_HOME} ${APP_HOME}
# SWITCH TO NON ROOT
USER ${APP_USER}
WORKDIR /usr/src/app
# INSTALL POETRY
RUN curl -sSL https://install.python-poetry.org | python3 -
ENV PATH="${POETRY_HOME}/bin:${VENV_PATH}/bin:${PATH}"
# INSTALL POETRY DEPENDENCIES
COPY --chown=$APP_USER:$APP_USER ./backend/poetry.lock ./backend/pyproject.toml ./
RUN poetry install --no-root --no-interaction --no-ansi
COPY ./backend /usr/src/app