Created
July 23, 2019 12:29
-
-
Save mvoitko/84cb93a2bec5b835ab04999814de5f0f to your computer and use it in GitHub Desktop.
The elegant method of activating virtualenv in Python container
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:18.04 | |
RUN apt-get update && apt-get install \ | |
-y --no-install-recommends python3 python3-virtualenv | |
ENV VIRTUAL_ENV=/opt/venv | |
RUN python3 -m virtualenv --python=/usr/bin/python3 $VIRTUAL_ENV | |
ENV PATH="$VIRTUAL_ENV/bin:$PATH" | |
# Install dependencies: | |
COPY requirements.txt . | |
RUN pip install -r requirements.txt | |
# Run the application: | |
COPY myapp.py . | |
CMD ["python", "myapp.py"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment