23 lines
674 B
Docker
23 lines
674 B
Docker
FROM python:3.10
|
|
|
|
# Install pipenv container-wide as root
|
|
RUN pip install pipenv
|
|
|
|
# Create unprivileged user with UID as specified by the build argument DEV_USER_UID, defaulting to 1000.
|
|
# (This should match the UID of your local user. If it doesn't, use an ".env" file to overwrite this variable.)
|
|
ARG DEV_USER_UID=1000
|
|
RUN echo Creating dev user with UID $DEV_USER_UID && \
|
|
useradd -m -u $DEV_USER_UID dev
|
|
USER dev
|
|
|
|
## Create virtual environment using pipenv
|
|
WORKDIR /app
|
|
COPY Pipfile Pipfile.lock ./
|
|
RUN pipenv install --dev --deploy
|
|
|
|
# Set entrypoint to always run commands inside virtual environment
|
|
ENTRYPOINT ["pipenv", "run"]
|
|
|
|
# Set default command
|
|
CMD ["bash"]
|