-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDockerfile.dev
More file actions
29 lines (21 loc) · 792 Bytes
/
Dockerfile.dev
File metadata and controls
29 lines (21 loc) · 792 Bytes
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
FROM python:3.10-slim-bullseye
# Creates application directory
WORKDIR /app
# Creates an appuser and change the ownership of the application's folder
RUN useradd -m appuser && chown appuser /app
RUN apt-get update \
&& apt-get -y install build-essential \
&& apt-get -y install gettext \
&& apt-get -y install git
# Installs poetry and pip
RUN pip install --upgrade pip && \
pip install poetry && \
poetry config virtualenvs.create false --local
# Copy dependency definition to cache
COPY --chown=appuser poetry.lock pyproject.toml /app/
# Installs projects dependencies as a separate layer
RUN poetry install --no-root
# Copies and chowns for the userapp on a single layer
COPY --chown=appuser . /app
# Switching to the non-root appuser for security
USER appuser