25 lines
798 B
Docker
25 lines
798 B
Docker
FROM python:3.10
|
|
|
|
# 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 -d /home/dev -u $DEV_USER_UID dev
|
|
USER dev
|
|
ENV PATH="/home/dev/.local/bin:${PATH}"
|
|
|
|
# Don't write bytecode cache files
|
|
ENV PYTHONDONTWRITEBYTECODE=1
|
|
|
|
# Install pipenv to generate requirements.txt from Pipfile
|
|
RUN pip install pipenv
|
|
|
|
# Generate requirements.txt and install dependencies with pip
|
|
WORKDIR /app
|
|
COPY Pipfile Pipfile.lock ./
|
|
RUN pipenv requirements --dev > tmp_requirements.txt && \
|
|
pip install -r tmp_requirements.txt
|
|
|
|
# Set default command
|
|
CMD ["bash"]
|