-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContainerfile
More file actions
141 lines (120 loc) · 6.34 KB
/
Containerfile
File metadata and controls
141 lines (120 loc) · 6.34 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
131
132
133
134
135
136
137
138
139
140
141
# --------------------------------------------------------------------------
# THIS FILE IS AUTOGENERATED - DO NOT EDIT MANUALLY
#
# Source: Containerfile.j2
# --------------------------------------------------------------------------
ARG BASE_VERSION=15
FROM ghcr.io/daemonless/base:${BASE_VERSION} AS builder
# Install build dependencies
RUN pkg update && \
pkg install -y \
FreeBSD-clibs-dev FreeBSD-runtime-dev FreeBSD-libexecinfo-dev \
FreeBSD-bmake FreeBSD-clang FreeBSD-clang-dev FreeBSD-toolchain \
FreeBSD-utilities-dev FreeBSD-zlib-dev FreeBSD-audit-dev \
python312 py312-sqlite3 \
rust gmake cmake pkgconf \
libffi webp libxslt libxml2 libjpeg-turbo libheif openjpeg \
lcms2 freetype2 harfbuzz openldap26-client postgresql17-client openssl libuv \
node24 npm-node24 yarn-node24 git-lite jq ca_root_nss && \
pkg clean -ay
# Fetch latest version from GitHub API
RUN MEALIE_VERSION=$(fetch -qo - https://api.github.com/repos/mealie-recipes/mealie/releases/latest | jq -r .tag_name) && \
echo "MEALIE_VERSION=${MEALIE_VERSION}" > /tmp/mealie_version && \
echo "Building Mealie ${MEALIE_VERSION}"
# Bootstrap pip for python 3.12 (py312-pip doesn't exist yet)
RUN python3.12 -m ensurepip --upgrade && \
python3.12 -m pip install --no-cache-dir --upgrade pip setuptools wheel
ENV CFLAGS="-I/usr/local/include -I/usr/local/include/libxml2" \
LDFLAGS="-L/usr/local/lib -L/usr/lib -L/lib" \
LIBRARY_PATH="/usr/lib:/lib:/usr/local/lib" \
RUSTFLAGS="-C link-arg=-L/usr/lib -C link-arg=-L/lib" \
CARGO_BUILD_JOBS=2 \
CARGO_PROFILE_RELEASE_CODEGEN_UNITS=16
# Build Rust-based packages with pip (orjson, pydantic-core need Rust)
# These aren't available as py312 packages yet
RUN pip install --no-cache-dir orjson pydantic-core pydantic && \
rm -rf /root/.cargo /root/.cache
# Download Mealie
RUN . /tmp/mealie_version && \
fetch -qo /tmp/mealie.tar.gz \
"https://github.com/mealie-recipes/mealie/archive/refs/tags/${MEALIE_VERSION}.tar.gz" && \
mkdir -p /app && tar -xzf /tmp/mealie.tar.gz -C /app --strip-components=1 && \
echo "${MEALIE_VERSION}" > /app/version && \
rm /tmp/mealie.tar.gz
WORKDIR /app
# Build frontend, then clean up node_modules + yarn cache to free disk space
RUN cd /app/frontend && \
sed -i '' 's/"sass-embedded":.*/"sass": "^1.85.0",/' package.json && \
yarn install && yarn generate && \
rm -rf node_modules .yarn /root/.cache/yarn /root/.npm /usr/local/share/.cache
# Create venv, copy ports packages, pip install the rest
RUN rm -rf /usr/local/lib/python3.12/site-packages/html5lib* && \
python3.12 -m venv /opt/mealie && \
cp -a /usr/local/lib/python3.12/site-packages/* /opt/mealie/lib/python3.12/site-packages/ && \
/opt/mealie/bin/pip install --no-cache-dir \
fastapi uvicorn[standard] sqlalchemy alembic psycopg2-binary \
pydantic-settings pillow pillow-heif lxml beautifulsoup4 \
recipe-scrapers extruct html2text requests httpx aiofiles \
bcrypt pyjwt authlib python-ldap python-dotenv python-slugify \
python-dateutil pyyaml jinja2 appdirs apprise pyhumps tzdata \
isodate text-unidecode paho-mqtt aniso8601 itsdangerous nltk \
regex openai typing_extensions click gunicorn python-multipart \
rapidfuzz ingredient-parser-nlp yt-dlp pint && \
/opt/mealie/bin/pip install --no-deps --no-cache-dir /app && \
mkdir -p /opt/mealie/lib/python3.12/site-packages/httpx_curl_cffi && \
printf 'import httpx\n\nclass AsyncCurlTransport(httpx.AsyncHTTPTransport):\n """FreeBSD shim: curl_cffi is Linux-only; use standard httpx transport."""\n def __init__(self, **kwargs):\n super().__init__(**kwargs)\n' \
> /opt/mealie/lib/python3.12/site-packages/httpx_curl_cffi/__init__.py
# Download NLTK data
RUN mkdir -p /nltk_data && \
/opt/mealie/bin/python -c "import nltk; nltk.download('averaged_perceptron_tagger_eng', download_dir='/nltk_data')"
# Production image
ARG BASE_VERSION
FROM ghcr.io/daemonless/base:${BASE_VERSION}
ARG FREEBSD_ARCH=amd64
ARG PACKAGES="python312 py312-sqlite3 libffi webp libxslt libxml2 libjpeg-turbo libheif openjpeg lcms2 freetype2 harfbuzz openldap26-client postgresql17-client openssl libuv ca_root_nss"
ARG UPSTREAM_URL="https://api.github.com/repos/mealie-recipes/mealie/releases/latest"
ARG UPSTREAM_JQ=".tag_name"
ARG HEALTHCHECK_ENDPOINT="http://localhost:9000/api/app/about"
ENV HEALTHCHECK_URL="${HEALTHCHECK_ENDPOINT}"
# --- Metadata (Injected by Generator) ---
LABEL org.opencontainers.image.title="Mealie" \
org.opencontainers.image.description="Intuitive self-hosted recipe management app designed to be the best recipe management experience on the web." \
org.opencontainers.image.source="https://github.com/daemonless/mealie" \
org.opencontainers.image.url="https://mealie.io/" \
org.opencontainers.image.documentation="https://docs.mealie.io/" \
org.opencontainers.image.licenses="AGPL-3.0-only" \
org.opencontainers.image.vendor="daemonless" \
org.opencontainers.image.authors="daemonless" \
io.daemonless.category="Utilities" \
io.daemonless.port="9000" \
io.daemonless.volumes="/config" \
io.daemonless.arch="${FREEBSD_ARCH}" \
io.daemonless.upstream-url="${UPSTREAM_URL}" \
io.daemonless.upstream-jq="${UPSTREAM_JQ}" \
io.daemonless.healthcheck-url="${HEALTHCHECK_ENDPOINT}" \
io.daemonless.packages="${PACKAGES}"
RUN pkg update && pkg install -y ${PACKAGES} && \
pkg clean -ay && rm -rf /var/cache/pkg/* /var/db/pkg/repos/*
COPY --from=builder --chown=bsd:bsd /opt/mealie /opt/mealie
COPY --from=builder --chown=bsd:bsd /nltk_data /nltk_data
COPY --from=builder --chown=bsd:bsd /app/frontend/.output /app/frontend/.output
COPY --from=builder --chown=bsd:bsd /app/mealie /app/mealie
COPY --from=builder --chown=bsd:bsd /app/version /app/version
RUN mkdir -p /config /run/secrets && \
ln -s /config /app/data && \
ln -s /app/frontend/.output/public /app/mealie/frontend && \
chown -R bsd:bsd /app /config /run/secrets
COPY root/ /
RUN chmod +x /etc/services.d/*/run /etc/cont-init.d/* 2>/dev/null || true
ENV MEALIE_HOME="/app" \
PYTHONPATH=/app \
NLTK_DATA=/nltk_data \
VENV_PATH="/opt/mealie" \
PATH="/opt/mealie/bin:$PATH" \
PRODUCTION=true \
TESTING=false \
APP_PORT=9000
# --- Expose (Injected by Generator) ---
EXPOSE 9000
# --- Volumes (Injected by Generator) ---
VOLUME /config