FROM --platform=linux/amd64 python:3.11-alpine ARG ENV=production ENV ENV=${ENV} \ PYTHONFAULTHANDLER=1 \ PYTHONUNBUFFERED=1 \ PYTHONHASHSEED=random \ PIP_NO_CACHE_DIR=off \ PIP_DISABLE_PIP_VERSION_CHECK=on \ PIP_DEFAULT_TIMEOUT=100 \ POETRY_VERSION=1.4.1 # System deps: RUN pip install "poetry==$POETRY_VERSION" # Copy only requirements to cache them in docker layer WORKDIR /code COPY poetry.lock pyproject.toml /code/ # Project initialization: RUN poetry config virtualenvs.create false \ && poetry install $(test "$ENV" == production && echo "--no-dev") --no-interaction --no-ansi # Creating folders, and files for a project: COPY main.py /code CMD ["/code/main.py"]