forked from raidensakura/modmail
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
49 lines (31 loc) · 1.02 KB
/
Copy pathDockerfile
File metadata and controls
49 lines (31 loc) · 1.02 KB
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
47
48
ARG PYTHON_VERSION=3.12
FROM python:${PYTHON_VERSION}-alpine AS base
RUN apk update && apk add git \
# pillow dependencies
jpeg-dev zlib-dev
FROM base AS python-deps
RUN apk add --virtual build-deps build-base gcc libffi-dev
#Install pdm
RUN pip install -U pip setuptools wheel
RUN pip install pdm
FROM python-deps AS builder
COPY pyproject.toml pdm.lock README.md /modmail/
WORKDIR /modmail
RUN pdm install --check --prod --no-editable --fail-fast;
ARG INCLUDE_SUPPORTUTILS=false
ARG INCLUDE_PIP=false
RUN if [ "$INCLUDE_SUPPORTUTILS" = "true" ]; then \
pdm install --prod -G supportutils --no-editable --fail-fast; \
fi
RUN if [ "$INCLUDE_PIP" = "true" ]; then \
/modmail/.venv/bin/python -m ensurepip --upgrade; \
fi
FROM base AS runtime
RUN adduser --disabled-password modmail
USER modmail
ENV USING_DOCKER=yes
COPY --chown=modmail:modmail --from=builder /modmail /modmail
COPY --chown=modmail:modmail . /modmail
WORKDIR /modmail
ENV PATH="/modmail/.venv/bin:${PATH}"
CMD ["python", "bot.py"]