-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
48 lines (40 loc) · 1.25 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
45
46
47
48
# The builder image, used to build the virtual environment
FROM python:3.12-slim
ARG DOCKER_UID 1000
ARG DOCKER_GID 1000
# Upgrade system packages to install security updates
RUN apt-get update && \
apt-get -y upgrade && \
rm -rf /var/lib/apt/lists/*
# Upgrade pip to its latest release to speed up dependencies
# installation
RUN pip install --upgrade pip && \
pip install pipenv==2024.4.0
# Pipenv configuration
ENV PIPENV_USER_UID=${DOCKER_UID}
ENV PIPENV_USER_GID=${DOCKER_GID}
ENV PIPENV_USER_NAME=pipenv
ENV PIPENV_GROUP_NAME=pipenv
ENV PIPENV_USER_HOME=/opt/pipenv/
ENV PIPENV_CUSTOM_VENV_NAME=qualicharge
# Create a pipenv user and group
RUN groupadd \
-g ${PIPENV_USER_GID} \
${PIPENV_GROUP_NAME} && \
useradd -rm \
-d ${PIPENV_USER_HOME} \
-s /bin/bash \
-u ${PIPENV_USER_UID} \
-g ${PIPENV_USER_GID} \
${PIPENV_USER_NAME}
# /app will be our working directory
RUN mkdir /app && \
chown ${PIPENV_USER_NAME}:${PIPENV_GROUP_NAME} /app
# -- build (⚠️ development only) --
COPY --chown="${PIPENV_USER_NAME}:${PIPENV_GROUP_NAME}" . /app
WORKDIR /app
USER ${PIPENV_USER_NAME}:${PIPENV_GROUP_NAME}
RUN pipenv install -d && \
pipenv install -v -e .
# -- Run --
CMD pipenv run honcho -f Procfile.dev start