-
-
Notifications
You must be signed in to change notification settings - Fork 327
Expand file tree
/
Copy pathDockerfile
More file actions
43 lines (30 loc) · 1.47 KB
/
Copy pathDockerfile
File metadata and controls
43 lines (30 loc) · 1.47 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
FROM python:3.11 AS build
ENV PYTHONUNBUFFERED=1
ENV PATH=/venv/bin:$PATH
WORKDIR /app
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked --mount=type=cache,target=/var/lib/apt,sharing=locked apt-get update && apt-get install -y gettext libgettextpo-dev tidy libpq5 libsass-dev
# libsass doesn't provide arm64 wheel and takes ~25min to compile in github action
# So tell libsass-python to use system installed libsass instead compiling one in build phase
# and build takes as whole ~2min in arm64 github action
ENV SYSTEM_SASS=True
RUN python -mvenv /venv
COPY pyproject.toml /app/
RUN --mount=type=cache,target=/root/.cache/pip pip install "pip>=25.1.0" && pip install --group main --group dev
FROM python:3.11-slim
WORKDIR /app
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked --mount=type=cache,target=/var/lib/apt,sharing=locked apt-get update && apt-get install -y gettext tidy libpq5 libsass1 curl
ENV PYTHONUNBUFFERED=1
ENV PATH=/venv/bin:$PATH
ENV SYSTEM_SASS=True
COPY --from=build /venv /venv
COPY --from=build /app /app
COPY entrypoint.sh /entrypoint.sh
COPY README.md LICENSE.md VERSION /app/
COPY manage.py gunicorn.conf.py /app/
COPY celerywyrm /app/celerywyrm
COPY locale /app/locale
COPY bookwyrm /app/bookwyrm
RUN python3 -mcompileall /app/bookwyrm /app/celerywyrm /app/manage.py /app/gunicorn.conf.py
VOLUME ["/app/exports", "/app/images", "/app/static"]
# Entrypoint script is used to do database migrations and collectstatic
ENTRYPOINT ["/entrypoint.sh"]