-
Notifications
You must be signed in to change notification settings - Fork 6
/
Dockerfile
46 lines (32 loc) · 1.17 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
FROM python:3.12 AS builder
ENV PYTHONUNBUFFERED=true \
PYTHONDONTWRITEBYTECODE=true \
PIP_NO_CACHE_DIR=off \
PIP_DISABLE_PIP_VERSION_CHECK=on \
PIP_DEFAULT_TIMEOUT=100 \
POETRY_NO_INTERACTION=true \
POETRY_VIRTUALENVS_IN_PROJECT=true \
POETRY_VIRTUALENVS_CREATE=true \
POETRY_CACHE_DIR=/tmp/poetry_cache \
POETRY_VIRTUALENVS_OPTIONS_ALWAYS_COPY=true \
POETRY_VIRTUALENVS_OPTIONS_NO_PIP=true \
POETRY_HOME=/opt/poetry
RUN apt-get update && apt-get install --no-install-recommends -y curl build-essential
RUN python3 -m venv $POETRY_HOME
RUN $POETRY_HOME/bin/pip install poetry==1.8.3
WORKDIR /app
COPY poetry.lock pyproject.toml README.md ./
RUN --mount=type=cache,target=$POETRY_CACHE_DIR $POETRY_HOME/bin/poetry install --without dev --no-root --no-interaction
FROM python:3.12-slim AS runtime
ENV LANG=C.UTF-8 \
VIRTUAL_ENV=/app/.venv \
PATH="/app/.venv/bin:$PATH"
COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV}
WORKDIR /app
COPY LICENSE .en[v] config.py main.py messages.json ./
RUN chmod +x main.py
COPY exceptions/ ./exceptions/
COPY utils/ ./utils/
COPY db/ ./db/
COPY cogs/ ./cogs/
ENTRYPOINT ["python", "-m", "main"]