-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathDockerfile
More file actions
50 lines (38 loc) · 1.26 KB
/
Dockerfile
File metadata and controls
50 lines (38 loc) · 1.26 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
49
50
# Install uv
FROM python:3.12-slim AS base
LABEL org.opencontainers.image.authors="Julien Maupetit <julien@maupetit.net>"
# Upgrade system packages to install security updates and weasyprint dependencies
RUN apt update && \
apt -y upgrade && \
apt install -y \
libpango-1.0-0 \
libpangoft2-1.0-0 \
libharfbuzz-subset0 \
&& \
rm -rf /var/lib/apt/lists/*
# Change the working directory to the `app` directory
WORKDIR /app
#
# -- BUILDER --
#
FROM base AS builder
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
# Install dependencies
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=bind,source=uv.lock,target=uv.lock \
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
uv sync --extra cli --extra latex --locked --no-install-project --no-editable
# Copy the project into the intermediate image
COPY . /app
# Sync the project
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --extra cli --extra latex --locked --no-editable
#
# -- PRODUCTION --
#
FROM base AS production
# Use a temporary home directory (with write permissions)
ENV HOME=/tmp
# Copy the environment, but not the source code
COPY --from=builder --chown=app:app /app/.venv /app/.venv
ENTRYPOINT ["/app/.venv/bin/md2pdf"]