-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathDockerfile.alpine
More file actions
52 lines (40 loc) · 1.33 KB
/
Dockerfile.alpine
File metadata and controls
52 lines (40 loc) · 1.33 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
51
52
# Install uv
FROM python:3.12-alpine AS base
LABEL org.opencontainers.image.authors="Julien Maupetit <julien@maupetit.net>"
# Upgrade system packages to install security updates and weasyprint dependencies
RUN apk add --no-cache \
so:libgobject-2.0.so.0 \
so:libpango-1.0.so.0 \
so:libharfbuzz.so.0 \
so:libharfbuzz-subset.so.0 \
so:libfontconfig.so.1 \
so:libpangoft2-1.0.so.0 \
font-liberation \
font-liberation-sans-narrow \
ttf-linux-libertine
# 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"]