-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContainerfile
More file actions
138 lines (119 loc) · 6.44 KB
/
Copy pathContainerfile
File metadata and controls
138 lines (119 loc) · 6.44 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
# --------------------------------------------------------------------------
# THIS FILE IS AUTOGENERATED - DO NOT EDIT MANUALLY
#
# Source: Containerfile.j2
# --------------------------------------------------------------------------
ARG BASE_VERSION=15.1-latest
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-pip py312-setuptools py312-wheel py312-sqlite3 \
py312-Jinja2 py312-pyyaml py312-aiofiles py312-alembic py312-apprise \
py312-bcrypt py312-beautifulsoup py312-extruct py312-fastapi \
py312-greenlet py312-html2text py312-httpx py312-joblib py312-lxml py312-mako \
py312-openai py312-orjson py312-pillow py312-pillow-heif \
py312-psycopg2 py312-pydantic2 py312-pydantic-core \
py312-pydantic-settings py312-python-dateutil py312-python-dotenv \
py312-python-ldap py312-python-multipart py312-python-slugify \
py312-regex py312-requests py312-sqlalchemy20 py312-tzdata py312-isodate \
py312-text-unidecode py312-rapidfuzz py312-authlib \
py312-pyjwt py312-typing-extensions py312-itsdangerous py312-uvicorn \
py312-yt-dlp py312-pint \
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}"
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
# 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 only packages that are missing
# from FreeBSD ports or where the port currently lags Mealie's pinned version.
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 \
recipe-scrapers==15.11.0 paho-mqtt==1.6.1 pyhumps==3.8.0 \
ingredient-parser-nlp==2.7.0 && \
/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 tiff libxslt libxml2 libxcb libjpeg-turbo libheif libimagequant libavif openjpeg lcms2 freetype2 libraqm 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