From a619bc406d779db57862a371e8570ca5de923b2e Mon Sep 17 00:00:00 2001 From: Marko Mikulicic Date: Tue, 3 Dec 2019 17:53:42 +0100 Subject: [PATCH] Switch to python3 venv --- bitnami/python/example/Dockerfile | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/bitnami/python/example/Dockerfile b/bitnami/python/example/Dockerfile index 174e4734679a..6fb684940e92 100644 --- a/bitnami/python/example/Dockerfile +++ b/bitnami/python/example/Dockerfile @@ -1,19 +1,22 @@ FROM bitnami/python:3 as builder +ENV PATH="/app/.venv/bin:${PATH}" +WORKDIR /app + +RUN python -m venv .venv COPY requirements.txt /app - -WORKDIR /app -RUN virtualenv . && \ - . bin/activate && \ - pip install -r requirements.txt +RUN pip install -r requirements.txt COPY . /app +RUN python manage.py migrate -RUN . bin/activate && \ - python manage.py migrate - +# The production image is constructed with a smaller, production grade +# base image, and your code built in the previous build stage. FROM bitnami/python:3-prod -COPY --from=builder /app /app +ENV PATH="/app/.venv/bin:${PATH}" WORKDIR /app + +COPY --from=builder /app /app + EXPOSE 8000 -CMD bash -c "source bin/activate && python manage.py runserver 0:8000" +CMD python manage.py runserver 0:8000