djangoBase/Dockerfile

26 lines
593 B
Docker

# syntax=docker/dockerfile:1
FROM alpine:3.14 as base
run apk --no-cache add python3 py3-pip py3-cryptography py3-psycopg2
ENV PYTHONUNBUFFERED=1
FROM base as pythonDeps
ENV PYTHONFAULTHANDLER=1 \
PYTHONUNBUFFERED=1 \
PYTHONHASHSEED=random \
PIP_NO_CACHE_DIR=off \
PIP_DISABLE_PIP_VERSION_CHECK=on \
PIP_DEFAULT_TIMEOUT=100
RUN pip3 install poetry
# Copy only requirements to cache them in docker layer
WORKDIR /code/
COPY ./requirements.txt /code/requirements.txt
RUN pip3 install -r requirements.txt
from pythonDeps as final
# Bake code directory into the app
copy ./ /code/