A simple python container based on python:3.7.3-alpine which installs packages using pip during startup
UID - UID for the user used in the container (default: 1000)GID - GID for the user used in the container (default: 1000)PYTHONUNBUFFERED - Used to see python print("something") in the container's log (defult: 0)/some/dir/src - Contains app.py and requirements.txt with all the packages that need to be installed on container startupFROM python:3.7.3-slim-stretch
LABEL maintainer="Max1r"
ENV UID=1000
ENV GID=1000
RUN mkdir /.local /home/james
RUN chown -R $UID:$GID /.local /home/james /usr/local
USER $UID:$GID
WORKDIR "/home/james"
RUN pip install virtualenv
RUN virtualenv environment1 -p python3
RUN ["/bin/bash", "-c", "source environment1/bin/activate"]
# Set working directory to shared folder from host
VOLUME /src
ENV PYTHONUNBUFFERED=0
CMD pip install --no-cache-dir --disable-pip-version-check --upgrade pip -r /src/requirements.txt && python -u /src/app.py
Content type
Image
Digest
Size
87.5 MB
Last updated
over 5 years ago
docker pull max1r/python-pip