Add virtualenv to PATH

pull/399/head
Jake Howard 2023-02-03 11:20:24 +00:00 zatwierdzone przez Matt Westcott
rodzic 97bacc0c03
commit b541446e25
2 zmienionych plików z 8 dodań i 6 usunięć

Wyświetl plik

@ -19,6 +19,8 @@ RUN set -ex \
&& rm -rf /var/lib/apt/lists/*
ADD requirements/ /requirements/
ENV VIRTUAL_ENV=/venv PATH=/venv/bin:$PATH
RUN set -ex \
&& BUILD_DEPS=" \
build-essential \
@ -31,9 +33,9 @@ RUN set -ex \
zlib1g-dev \
" \
&& apt-get update && apt-get install -y --no-install-recommends $BUILD_DEPS \
&& python3.9 -m venv /venv \
&& /venv/bin/pip install -U pip \
&& /venv/bin/pip install --no-cache-dir -r /requirements/production.txt \
&& python3.9 -m venv ${VIRTUAL_ENV} \
&& pip install -U pip \
&& pip install --no-cache-dir -r /requirements/production.txt \
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $BUILD_DEPS \
&& rm -rf /var/lib/apt/lists/*
@ -47,7 +49,7 @@ EXPOSE 8000
ENV DJANGO_SETTINGS_MODULE=bakerydemo.settings.production DJANGO_DEBUG=off
# Call collectstatic with dummy environment variables:
RUN DATABASE_URL=postgres://none REDIS_URL=none /venv/bin/python manage.py collectstatic --noinput
RUN DATABASE_URL=postgres://none REDIS_URL=none python manage.py collectstatic --noinput
# make sure static files are writable by uWSGI process
RUN mkdir -p /code/bakerydemo/media/images && chown -R 1000:2000 /code/bakerydemo/media
@ -59,4 +61,4 @@ VOLUME ["/code/bakerydemo/media/images/"]
ENTRYPOINT ["/code/docker-entrypoint.sh"]
# Start uWSGI
CMD ["/venv/bin/uwsgi", "/code/etc/uwsgi.ini"]
CMD ["uwsgi", "/code/etc/uwsgi.ini"]

Wyświetl plik

@ -4,7 +4,7 @@ master=true
workers=2
threads=4
http-keepalive=1
virtualenv=/venv
virtualenv=$(VIRTUAL_ENV)
wsgi-env-behaviour=holy
http-auto-chunked=true
lazy-apps=true