forked from modmail-dev/Modmail
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile
37 lines (24 loc) · 881 Bytes
/
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
FROM python:3.11-alpine AS base
RUN apk update && apk add git \
# pillow dependencies
jpeg-dev zlib-dev && \
pip install --upgrade pip && \
adduser -D -h /home/modmail -g 'Modmail' modmail
WORKDIR /home/modmail
FROM base AS builder
ENV POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
POETRY_VIRTUALENVS_CREATE=1 \
POETRY_CACHE_DIR=/tmp/poetry_cache
RUN apk add build-base libffi-dev && \
pip install -U poetry
COPY --chown=modmail:modmail poetry.lock pyproject.toml /home/modmail/
RUN --mount=type=cache,target=$POETRY_CACHE_DIR poetry install --without dev --no-root
FROM base AS runtime
ENV VIRTUAL_ENV=/home/modmail/.venv \
PATH="/home/modmail/.venv/bin:$PATH" \
USING_DOCKER=yes
COPY --from=builder --chown=modmail:modmail ${VIRTUAL_ENV} ${VIRTUAL_ENV}
COPY --chown=modmail:modmail . .
USER modmail
CMD ["python", "bot.py"]