Dockerfile from slim Debian image, remove poetry from server image
This commit is contained in:
+18
-8
@@ -1,18 +1,28 @@
|
|||||||
FROM python:3.9-slim
|
FROM python:3.9-slim-buster as builder
|
||||||
ENV PYTHONUNBUFFERED 1
|
ENV PYTHONUNBUFFERED 1
|
||||||
WORKDIR /app
|
|
||||||
COPY . ./
|
COPY . ./
|
||||||
|
|
||||||
ENV POETRY_VERSION=1.1.4
|
ENV POETRY_VERSION=1.1.4
|
||||||
|
|
||||||
RUN apt-get update && apt-get install --no-install-recommends -y build-essential
|
|
||||||
|
|
||||||
RUN pip install -U pip
|
|
||||||
RUN pip install "poetry==$POETRY_VERSION"
|
RUN pip install "poetry==$POETRY_VERSION"
|
||||||
|
RUN poetry export > requirements.txt
|
||||||
|
|
||||||
RUN poetry config virtualenvs.create false \
|
FROM python:3.9-slim-buster as server
|
||||||
&& poetry install --no-dev --no-interaction --no-ansi
|
|
||||||
|
WORKDIR /app
|
||||||
|
COPY . ./
|
||||||
|
COPY --from=builder requirements.txt ./
|
||||||
|
|
||||||
|
ENV PYTHONUNBUFFERED=1 \
|
||||||
|
# prevents python creating .pyc files
|
||||||
|
PYTHONDONTWRITEBYTECODE=1 \
|
||||||
|
# pip
|
||||||
|
PIP_NO_CACHE_DIR=off \
|
||||||
|
PIP_DISABLE_PIP_VERSION_CHECK=on \
|
||||||
|
PIP_DEFAULT_TIMEOUT=100
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install --no-install-recommends -y build-essential
|
||||||
|
RUN pip install -r requirements.txt
|
||||||
|
|
||||||
RUN python manage.py collectstatic --noinput
|
RUN python manage.py collectstatic --noinput
|
||||||
|
|
||||||
CMD ["sh", "-c", "./production_entrypoint.sh"]
|
CMD ["sh", "-c", "./production_entrypoint.sh"]
|
||||||
|
|||||||
Reference in New Issue
Block a user