| 
									
										
										
										
											2025-02-12 01:28:40 +10:00
										 |  |  | ###############################################
 | 
					
						
							|  |  |  | # Frontend Build
 | 
					
						
							|  |  |  | ###############################################
 | 
					
						
							|  |  |  | FROM node:16 AS frontend-builder
 | 
					
						
							| 
									
										
										
										
											2022-12-31 10:01:15 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-02-12 01:28:40 +10:00
										 |  |  | WORKDIR /frontend
 | 
					
						
							| 
									
										
										
										
											2022-12-31 10:01:15 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-02-12 01:28:40 +10:00
										 |  |  | COPY frontend .
 | 
					
						
							| 
									
										
										
										
											2022-12-31 10:01:15 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | RUN yarn install \
 | 
					
						
							|  |  |  |     --prefer-offline \
 | 
					
						
							|  |  |  |     --frozen-lockfile \
 | 
					
						
							|  |  |  |     --non-interactive \
 | 
					
						
							|  |  |  |     --production=false \
 | 
					
						
							|  |  |  |     # https://github.com/docker/build-push-action/issues/471
 | 
					
						
							|  |  |  |     --network-timeout 1000000
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-14 06:40:13 -08:00
										 |  |  | RUN yarn generate
 | 
					
						
							| 
									
										
										
										
											2022-12-31 10:01:15 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-23 02:22:31 +08:00
										 |  |  | ###############################################
 | 
					
						
							| 
									
										
										
										
											2022-12-31 10:01:15 -08:00
										 |  |  | # Base Image - Python
 | 
					
						
							| 
									
										
										
										
											2021-06-23 02:22:31 +08:00
										 |  |  | ###############################################
 | 
					
						
							| 
									
										
										
										
											2024-12-04 22:31:26 -06:00
										 |  |  | FROM python:3.12-slim as python-base
 | 
					
						
							| 
									
										
										
										
											2021-04-03 13:23:26 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-23 02:22:31 +08:00
										 |  |  | ENV MEALIE_HOME="/app"
 | 
					
						
							| 
									
										
										
										
											2021-04-03 13:23:26 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-23 02:22:31 +08:00
										 |  |  | ENV PYTHONUNBUFFERED=1 \
 | 
					
						
							|  |  |  |     PYTHONDONTWRITEBYTECODE=1 \
 | 
					
						
							|  |  |  |     PIP_NO_CACHE_DIR=off \
 | 
					
						
							|  |  |  |     PIP_DISABLE_PIP_VERSION_CHECK=on \
 | 
					
						
							|  |  |  |     PIP_DEFAULT_TIMEOUT=100 \
 | 
					
						
							| 
									
										
										
										
											2025-02-12 01:28:40 +10:00
										 |  |  |     VENV_PATH="/opt/mealie"
 | 
					
						
							| 
									
										
										
										
											2020-12-24 16:37:38 -09:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-02-12 01:28:40 +10:00
										 |  |  | # prepend venv to path
 | 
					
						
							|  |  |  | ENV PATH="$VENV_PATH/bin:$PATH"
 | 
					
						
							| 
									
										
										
										
											2021-02-08 09:47:40 -09:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-23 02:22:31 +08:00
										 |  |  | # create user account
 | 
					
						
							|  |  |  | RUN useradd -u 911 -U -d $MEALIE_HOME -s /bin/bash abc \
 | 
					
						
							|  |  |  |     && usermod -G users abc \
 | 
					
						
							|  |  |  |     && mkdir $MEALIE_HOME
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ###############################################
 | 
					
						
							| 
									
										
										
										
											2025-02-12 01:28:40 +10:00
										 |  |  | # Backend Package Build
 | 
					
						
							| 
									
										
										
										
											2021-06-23 02:22:31 +08:00
										 |  |  | ###############################################
 | 
					
						
							| 
									
										
										
										
											2025-02-12 01:28:40 +10:00
										 |  |  | FROM python-base AS backend-builder
 | 
					
						
							| 
									
										
										
										
											2021-06-23 02:22:31 +08:00
										 |  |  | RUN apt-get update \
 | 
					
						
							|  |  |  |     && apt-get install --no-install-recommends -y \
 | 
					
						
							| 
									
										
										
										
											2021-02-08 09:47:40 -09:00
										 |  |  |     curl \
 | 
					
						
							| 
									
										
										
										
											2025-02-12 01:28:40 +10:00
										 |  |  |     && rm -rf /var/lib/apt/lists/*
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ENV POETRY_HOME="/opt/poetry" \
 | 
					
						
							|  |  |  |     POETRY_NO_INTERACTION=1
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # prepend poetry to path
 | 
					
						
							|  |  |  | ENV PATH="$POETRY_HOME/bin:$PATH"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # install poetry - respects $POETRY_VERSION & $POETRY_HOME
 | 
					
						
							|  |  |  | ENV POETRY_VERSION=2.0.1
 | 
					
						
							|  |  |  | RUN curl -sSL https://install.python-poetry.org | python3 -
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # install poetry plugins needed to build the package
 | 
					
						
							|  |  |  | RUN poetry self add "poetry-plugin-export>=1.9"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | WORKDIR /mealie
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # copy project files here to ensure they will be cached.
 | 
					
						
							|  |  |  | COPY poetry.lock pyproject.toml ./
 | 
					
						
							|  |  |  | COPY mealie ./mealie
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Copy frontend to package it into the wheel
 | 
					
						
							|  |  |  | COPY --from=frontend-builder /frontend/dist ./mealie/frontend
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Build the source and binary package
 | 
					
						
							|  |  |  | RUN poetry build --output=dist
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Create the requirements file, which is used to install the built package and
 | 
					
						
							|  |  |  | # its pinned dependencies later. mealie is included to ensure the built one is
 | 
					
						
							|  |  |  | # what's installed.
 | 
					
						
							|  |  |  | RUN export MEALIE_VERSION=$(poetry version --short) \
 | 
					
						
							|  |  |  |     && poetry export --only=main --extras=pgsql --output=dist/requirements.txt \
 | 
					
						
							|  |  |  |     && echo "mealie[pgsql]==$MEALIE_VERSION \\" >> dist/requirements.txt \
 | 
					
						
							|  |  |  |     && poetry run pip hash dist/mealie-$MEALIE_VERSION-py3-none-any.whl | tail -n1 | tr -d '\n' >> dist/requirements.txt \
 | 
					
						
							|  |  |  |     && echo " \\" >> dist/requirements.txt \
 | 
					
						
							|  |  |  |     && poetry run pip hash dist/mealie-$MEALIE_VERSION.tar.gz | tail -n1 >> dist/requirements.txt
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ###############################################
 | 
					
						
							|  |  |  | # Package Container
 | 
					
						
							|  |  |  | # Only role is to hold the packages, or be overriden by a --build-context flag.
 | 
					
						
							|  |  |  | ###############################################
 | 
					
						
							|  |  |  | FROM scratch AS packages
 | 
					
						
							|  |  |  | COPY --from=backend-builder /mealie/dist /
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ###############################################
 | 
					
						
							|  |  |  | # Python Virtual Environment Build
 | 
					
						
							|  |  |  | ###############################################
 | 
					
						
							|  |  |  | # Install packages required to build the venv, in parallel to building the wheel
 | 
					
						
							|  |  |  | FROM python-base AS venv-builder-base
 | 
					
						
							|  |  |  | RUN apt-get update \
 | 
					
						
							|  |  |  |     && apt-get install --no-install-recommends -y \
 | 
					
						
							| 
									
										
										
										
											2021-06-23 02:22:31 +08:00
										 |  |  |     build-essential \
 | 
					
						
							| 
									
										
										
										
											2021-05-01 13:35:57 -08:00
										 |  |  |     libpq-dev \
 | 
					
						
							| 
									
										
										
										
											2021-04-29 17:47:01 -08:00
										 |  |  |     libwebp-dev \
 | 
					
						
							| 
									
										
										
										
											2021-11-26 12:16:08 -09:00
										 |  |  |     # LDAP Dependencies
 | 
					
						
							| 
									
										
										
										
											2022-03-15 15:01:56 -08:00
										 |  |  |     libsasl2-dev libldap2-dev libssl-dev \
 | 
					
						
							| 
									
										
										
										
											2021-06-23 02:22:31 +08:00
										 |  |  |     gnupg gnupg2 gnupg1 \
 | 
					
						
							| 
									
										
										
										
											2025-02-12 01:28:40 +10:00
										 |  |  |     && rm -rf /var/lib/apt/lists/*
 | 
					
						
							|  |  |  | RUN python3 -m venv --upgrade-deps $VENV_PATH
 | 
					
						
							| 
									
										
										
										
											2021-04-29 17:47:01 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-02-12 01:28:40 +10:00
										 |  |  | # Install the wheel and all dependencies into the venv
 | 
					
						
							|  |  |  | FROM venv-builder-base AS venv-builder
 | 
					
						
							| 
									
										
										
										
											2021-04-29 17:47:01 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-02-12 01:28:40 +10:00
										 |  |  | # Copy built package (wheel) and its dependency requirements
 | 
					
						
							|  |  |  | COPY --from=packages * /dist/
 | 
					
						
							| 
									
										
										
										
											2021-01-17 22:22:54 -09:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-02-12 01:28:40 +10:00
										 |  |  | # Install the wheel with exact versions of dependencies into the venv
 | 
					
						
							|  |  |  | RUN . $VENV_PATH/bin/activate \
 | 
					
						
							|  |  |  |     && pip install --require-hashes -r /dist/requirements.txt --find-links /dist
 | 
					
						
							| 
									
										
										
										
											2021-06-23 02:22:31 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-09 13:08:23 -08:00
										 |  |  | ###############################################
 | 
					
						
							|  |  |  | # CRFPP Image
 | 
					
						
							|  |  |  | ###############################################
 | 
					
						
							|  |  |  | FROM hkotel/crfpp as crfpp
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-15 15:01:56 -08:00
										 |  |  | RUN echo "crfpp-container"
 | 
					
						
							| 
									
										
										
										
											2021-10-09 13:08:23 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-23 02:22:31 +08:00
										 |  |  | ###############################################
 | 
					
						
							|  |  |  | # Production Image
 | 
					
						
							|  |  |  | ###############################################
 | 
					
						
							|  |  |  | FROM python-base as production
 | 
					
						
							| 
									
										
										
										
											2024-10-08 16:38:06 +02:00
										 |  |  | LABEL org.opencontainers.image.source="https://github.com/mealie-recipes/mealie"
 | 
					
						
							| 
									
										
										
										
											2021-06-23 02:22:31 +08:00
										 |  |  | ENV PRODUCTION=true | 
					
						
							| 
									
										
										
										
											2022-02-08 13:38:12 -09:00
										 |  |  | ENV TESTING=false | 
					
						
							| 
									
										
										
										
											2021-06-23 02:22:31 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-24 20:29:01 -08:00
										 |  |  | ARG COMMIT
 | 
					
						
							|  |  |  | ENV GIT_COMMIT_HASH=$COMMIT
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-23 02:22:31 +08:00
										 |  |  | RUN apt-get update \
 | 
					
						
							|  |  |  |     && apt-get install --no-install-recommends -y \
 | 
					
						
							| 
									
										
										
										
											2022-10-22 20:00:13 -08:00
										 |  |  |     gosu \
 | 
					
						
							| 
									
										
										
										
											2023-06-25 20:22:21 +02:00
										 |  |  |     iproute2 \
 | 
					
						
							| 
									
										
										
										
											2023-06-27 20:25:41 -05:00
										 |  |  |     libldap-common \
 | 
					
						
							| 
									
										
										
										
											2023-12-15 11:38:09 -06:00
										 |  |  |     libldap-2.5 \
 | 
					
						
							| 
									
										
										
										
											2021-06-23 02:22:31 +08:00
										 |  |  |     && rm -rf /var/lib/apt/lists/*
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-07-17 21:24:53 +10:00
										 |  |  | # create directory used for Docker Secrets
 | 
					
						
							|  |  |  | RUN mkdir -p /run/secrets
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-02-12 01:28:40 +10:00
										 |  |  | # copy CRF++ and add it to the library path
 | 
					
						
							| 
									
										
										
										
											2021-10-09 13:08:23 -08:00
										 |  |  | ENV LD_LIBRARY_PATH=/usr/local/lib
 | 
					
						
							|  |  |  | COPY --from=crfpp /usr/local/lib/ /usr/local/lib
 | 
					
						
							|  |  |  | COPY --from=crfpp /usr/local/bin/crf_learn /usr/local/bin/crf_learn
 | 
					
						
							|  |  |  | COPY --from=crfpp /usr/local/bin/crf_test /usr/local/bin/crf_test
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-02-12 01:28:40 +10:00
										 |  |  | # Copy venv into image. It contains a fully-installed mealie backend and frontend.
 | 
					
						
							|  |  |  | COPY --from=venv-builder $VENV_PATH $VENV_PATH
 | 
					
						
							| 
									
										
										
										
											2021-04-29 17:47:01 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-23 02:22:31 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-09 13:08:23 -08:00
										 |  |  | # Grab CRF++ Model Release
 | 
					
						
							| 
									
										
										
										
											2025-02-12 01:28:40 +10:00
										 |  |  | RUN python -m mealie.scripts.install_model
 | 
					
						
							| 
									
										
										
										
											2021-10-09 13:08:23 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-23 02:22:31 +08:00
										 |  |  | VOLUME [ "$MEALIE_HOME/data/" ]
 | 
					
						
							| 
									
										
										
										
											2022-02-20 14:17:51 -09:00
										 |  |  | ENV APP_PORT=9000 | 
					
						
							| 
									
										
										
										
											2021-01-05 14:14:55 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-23 02:22:31 +08:00
										 |  |  | EXPOSE ${APP_PORT}
 | 
					
						
							| 
									
										
										
										
											2021-04-10 21:42:04 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-02-12 01:28:40 +10:00
										 |  |  | HEALTHCHECK CMD python -m mealie.scripts.healthcheck || exit 1
 | 
					
						
							| 
									
										
										
										
											2022-12-31 10:01:15 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | ENV HOST 0.0.0.0
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | EXPOSE ${APP_PORT}
 | 
					
						
							| 
									
										
										
										
											2023-09-14 06:40:13 -08:00
										 |  |  | COPY ./docker/entry.sh $MEALIE_HOME/run.sh
 | 
					
						
							| 
									
										
										
										
											2022-12-31 10:01:15 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | RUN chmod +x $MEALIE_HOME/run.sh
 | 
					
						
							| 
									
										
										
										
											2024-01-11 17:03:08 -06:00
										 |  |  | ENTRYPOINT ["/app/run.sh"]
 |