32 lines
684 B
Docker
32 lines
684 B
Docker
FROM python:3-alpine as base
|
|
|
|
ENV PYTHONFAULTHANDLER=1 \
|
|
PYTHONHASHSEED=random \
|
|
PYTHONUNBUFFERED=1
|
|
|
|
WORKDIR /app
|
|
|
|
FROM base as builder
|
|
|
|
ENV PIP_DEFAULT_TIMEOUT=100 \
|
|
PIP_DISABLE_PIP_VERSION_CHECK=1 \
|
|
PIP_NO_CACHE_DIR=1 \
|
|
POETRY_VERSION=1.2.2
|
|
|
|
RUN apk add --no-cache gcc libffi-dev musl-dev
|
|
RUN pip install "poetry==$POETRY_VERSION"
|
|
RUN python -m venv /venv
|
|
|
|
COPY pyproject.toml poetry.lock ./
|
|
RUN poetry export --without-hashes -f requirements.txt | /venv/bin/pip install -r /dev/stdin
|
|
|
|
COPY . .
|
|
RUN poetry build && /venv/bin/pip install dist/*.whl
|
|
|
|
FROM base as final
|
|
|
|
WORKDIR /venv
|
|
|
|
COPY --from=builder /venv /venv
|
|
ENV VIRTUAL_ENV="/venv"
|
|
CMD ["/venv/bin/bot"]
|