forked from modmail-dev/Modmail
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into logviewer-registry
- Loading branch information
Showing
3 changed files
with
64 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,38 @@ | ||
FROM python:3.10 as py | ||
FROM python:3.11-slim-bookworm as base | ||
|
||
FROM py as build | ||
RUN apt-get update && \ | ||
apt-get install --no-install-recommends -y \ | ||
# Install CairoSVG dependencies. | ||
libcairo2 && \ | ||
# Cleanup APT. | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* && \ | ||
# Create a non-root user. | ||
useradd --shell /usr/sbin/nologin --create-home -d /opt/modmail modmail | ||
|
||
RUN apt update && apt install -y g++ git | ||
FROM base as builder | ||
|
||
COPY requirements.txt / | ||
RUN pip install --prefix=/inst -U -r /requirements.txt | ||
COPY requirements.txt . | ||
|
||
FROM py | ||
RUN pip install --root-user-action=ignore --no-cache-dir --upgrade pip wheel && \ | ||
python -m venv /opt/modmail/.venv && \ | ||
. /opt/modmail/.venv/bin/activate && \ | ||
pip install --no-cache-dir --upgrade -r requirements.txt | ||
|
||
COPY --from=build /inst /usr/local | ||
FROM base | ||
|
||
ENV USING_DOCKER yes | ||
RUN useradd --system --no-create-home modmail | ||
USER modmail | ||
# Copy the entire venv. | ||
COPY --from=builder --chown=modmail:modmail /opt/modmail/.venv /opt/modmail/.venv | ||
|
||
# Copy repository files. | ||
WORKDIR /opt/modmail | ||
USER modmail:modmail | ||
COPY --chown=modmail:modmail . . | ||
|
||
# This sets some Python runtime variables and disables the internal auto-update. | ||
ENV PYTHONUNBUFFERED=1 \ | ||
PYTHONDONTWRITEBYTECODE=1 \ | ||
PATH=/opt/modmail/.venv/bin:$PATH \ | ||
USING_DOCKER=yes | ||
|
||
WORKDIR /modmailbot | ||
CMD ["python", "bot.py"] | ||
COPY --chown=modmail:modmail . /modmailbot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters