-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContainerfile
More file actions
130 lines (101 loc) · 4.95 KB
/
Copy pathContainerfile
File metadata and controls
130 lines (101 loc) · 4.95 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# --------------------------------------------------------------------------
# THIS FILE IS AUTOGENERATED - DO NOT EDIT MANUALLY
#
# Source: Containerfile.j2
# --------------------------------------------------------------------------
ARG BASE_VERSION=15
ARG UPSTREAM_URL="https://api.github.com/repos/paperless-ngx/paperless-ngx/releases/latest"
ARG UPSTREAM_JQ=".tag_name"
ARG TARBALL_JQ=".assets[0].browser_download_url"
FROM ghcr.io/daemonless/base:${BASE_VERSION} AS builder
# Install build tools
RUN pkg update && pkg install -y FreeBSD-set-devel rust gmake python312 libxslt && \
pkg clean -ay && rm -rf /var/cache/pkg/* /var/db/pkg/repos/*
# Install build dependencies
RUN pkg update && pkg install -y pkgconf cmake gcc14 libxslt mariadb118-client postgresql18-client openblas libheif qpdf poppler && \
pkg clean -ay && rm -rf /var/cache/pkg/* /var/db/pkg/repos/*
ARG UPSTREAM_URL
ARG UPSTREAM_JQ
ARG TARBALL_JQ
# Fetch and extract source tarball
RUN TARBALL=$(fetch -qo - "${UPSTREAM_URL}" | jq -r "${TARBALL_JQ}") && \
fetch -qo /tmp/paperless.tar.gz "${TARBALL}" && \
mkdir -m 0755 -p /src && \
tar -C /src -xzf /tmp/paperless.tar.gz --strip-components 1 && \
rm -f /tmp/paperless.tar.gz
# Setup bsd user for build
RUN /etc/cont-init.d/10-usermod
# Install pip
RUN su -l bsd -c "/usr/local/bin/python3.12 -m ensurepip --user"
# Add python3 symlink
RUN cd /usr/local/bin && ln -sf python3.12 python3
WORKDIR /src
RUN echo Patching requirements.txt && \
sed -i "" 's/sys_platform == '\''darwin'\''/sys_platform == '\''freebsd15'\''/' requirements.txt
RUN echo Installing requirements && \
su -l bsd -c "cd /src && FC=/usr/local/bin/gfortran14 /config/.local/bin/pip3 install -r requirements.txt --user"
RUN echo Installing pdftotext && \
su -l bsd -c "/usr/local/bin/python3.12 -m pip install pdftotext --user"
FROM ghcr.io/daemonless/base:${BASE_VERSION}
ARG FREEBSD_ARCH=amd64
ARG UPSTREAM_URL
ARG UPSTREAM_JQ
ARG PACKAGES="python312 py312-sqlite3 libxslt mariadb118-client postgresql18-client openblas libheif qpdf gnupg ImageMagick7-nox11 optipng tesseract unpaper poppler-utils liberation-fonts-ttf"
ARG APP_VERSION="latest"
LABEL org.opencontainers.image.title="Paperless-ngx" \
org.opencontainers.image.description="A community-supported open-source document management system that transforms your physical documents into a searchable online archive so you can keep, well, less paper." \
org.opencontainers.image.source="https://github.com/daemonless/paperless-ngx" \
org.opencontainers.image.url="https://paperless-ngx.org/" \
org.opencontainers.image.licenses="GPL-3.0-only" \
org.opencontainers.image.vendor="daemonless" \
org.opencontainers.image.authors="daemonless" \
io.daemonless.category="Utilities" \
io.daemonless.port="8000" \
io.daemonless.arch="${FREEBSD_ARCH}" \
io.daemonless.packages="${PACKAGES}" \
io.daemonless.upstream-url="${UPSTREAM_URL}" \
io.daemonless.upstream-jq="${UPSTREAM_JQ}"
# Update to latest patch level
RUN pkg update -r FreeBSD-base && \
pkg upgrade -y -r FreeBSD-base && \
pkg clean -ay && \
rm -rf /var/cache/pkg/* /var/db/pkg/repos/*
# Install run dependencies
RUN pkg update && \
pkg install -y ${PACKAGES} && \
pkg clean -ay && \
rm -rf /var/cache/pkg/* /var/db/pkg/repos/*
# Add python3 symlink
RUN cd /usr/local/bin && ln -sf python3.12 python3
COPY --from=builder --chown=bsd:bsd --chmod=755 /config/.local/ /app/.local/
COPY --from=builder --chown=bsd:bsd --chmod=755 /src/static/ /app/static/
COPY --from=builder --chown=bsd:bsd --chmod=755 /src/src/ /app/src/
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
# Ignore warning from Whitenoise about async iterators
PYTHONWARNINGS="ignore:::django.http.response:517" \
PNGX_CONTAINERIZED=1 \
# https://docs.astral.sh/uv/reference/settings/#link-mode
UV_LINK_MODE=copy \
PYTHONPATH=/app/.local/lib/python3.12/site-packages
# Install NLTK data
RUN echo "Installing NLTK_DATA ..." && \
su -m bsd -c "mkdir /app/nltk_data && cd /app && /usr/local/bin/python3.12 -m nltk.downloader -d /app/nltk_data snowball_data stopwords punkt punkt_tab"
ENV PAPERLESS_NLTK_DIR=/app/nltk_data \
PAPERLESS_ENABLE_NLTK=true \
PAPERLESS_MEDIA_ROOT=/config/media \
PAPERLESS_DATA_DIR=/config/data \
PAPERLESS_CONSUMPTION_DIR=/config/consume \
PAPERLESS_THUMBNAIL_FONT_NAME=/usr/local/share/fonts/Liberation/LiberationSerif-Regular.ttf \
PAPERLESS_ENABLE_FLOWER=true \
GRANIAN_HOST=0.0.0.0
# Extract version information
RUN su -m bsd -c "cd /app/src && /usr/local/bin/python3.12 -c 'from paperless import version; print(version.__full_version_str__)' > /app/version"
# Copy root filesystem
COPY root/ /
## Set permissions
RUN chmod +x /etc/services.d/*/run /etc/cont-init.d/* /healthz 2>/dev/null || true
# --- Expose (Injected by Generator) ---
EXPOSE 8000 5555
# --- Volumes (Injected by Generator) ---
VOLUME /config /config/media/documents