FROM python:3.8.9-slim-buster ENV BUILD_ONLY_PACKAGES='wget' \ # python: PYTHONFAULTHANDLER=1 \ PYTHONUNBUFFERED=1 \ PYTHONHASHSEED=random \ PYTHONDONTWRITEBYTECODE=1 \ # pip: PIP_NO_CACHE_DIR=off \ PIP_DISABLE_PIP_VERSION_CHECK=on \ PIP_DEFAULT_TIMEOUT=100 \ # poetry: POETRY_VERSION=1.1.4 \ POETRY_NO_INTERACTION=1 \ POETRY_VIRTUALENVS_CREATE=false \ POETRY_CACHE_DIR='/var/cache/pypoetry' \ PATH="$PATH:/root/.poetry/bin" # System deps: RUN apt-get update \ && apt-get install --no-install-recommends -y \ bash \ build-essential \ curl \ gettext \ git \ libpq-dev \ nano \ # Defining build-time-only dependencies: $BUILD_ONLY_PACKAGES \ && curl -sSL 'https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py' | python \ && poetry --version \ # Removing build-time-only dependencies: && apt-get remove -y $BUILD_ONLY_PACKAGES \ # Cleaning cache: && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ && apt-get clean -y && rm -rf /var/lib/apt/lists/* \ && rm -rf $POETRY_CACHE_DIR WORKDIR /code # Copy only requirements, to cache them in docker layer COPY ./poetry.lock ./pyproject.toml /code/ RUN poetry install COPY . /code