From 2b37de8f8bea395c785d32ff1df95963e8d45008 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Sat, 12 Oct 2024 12:57:05 +0200 Subject: [PATCH] Revert "test" This reverts commit fbd5082340288394abf715311033187f42ac5ea9. --- mealie/Dockerfile | 177 +++------------------------------------------- 1 file changed, 8 insertions(+), 169 deletions(-) diff --git a/mealie/Dockerfile b/mealie/Dockerfile index 3d0921f2f..52fc10e08 100644 --- a/mealie/Dockerfile +++ b/mealie/Dockerfile @@ -16,7 +16,7 @@ ARG BUILD_FROM ARG BUILD_VERSION -FROM ${BUILD_FROM} AS base-addon +FROM ${BUILD_FROM} ################## # 2 Modify Image # @@ -33,7 +33,7 @@ RUN grep -rl "/app/data" /app | xargs sed -i 's|/app/data|/config/addons_config/ sed -i "s|change_user$|# change_user|g" /app/run.sh ################## -# 3 Install Apps # +# 3 Install apps # ################## # Add rootfs @@ -58,164 +58,9 @@ ENV PACKAGES="nginx" ADD "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/ha_autoapps.sh" "/ha_autoapps.sh" RUN chmod 744 /ha_autoapps.sh && /ha_autoapps.sh "$PACKAGES" && rm /ha_autoapps.sh -############################################### -# 4 Integrate Mealie Dockerfile - Frontend Build -############################################### - -# Define build arguments for SUB_PATH -ARG SUB_PATH=/mealie_path/ -ENV SUB_PATH=${SUB_PATH} - -# Frontend Builder Stage -FROM node:16 AS mealie-frontend-builder - -WORKDIR /app/frontend - -# Copy frontend source code -COPY ./frontend . - -# Install dependencies -RUN yarn install \ - --prefer-offline \ - --frozen-lockfile \ - --non-interactive \ - --production=false \ - --network-timeout 1000000 - -# Pass SUB_PATH to the build environment -ENV SUB_PATH=${SUB_PATH} - -# Build the frontend -RUN yarn generate - -############################################### -# 5 Integrate Mealie Dockerfile - Python Base and Dependencies -############################################### - -FROM python:3.10-slim AS mealie-python-base - -ENV MEALIE_HOME="/app" - -ENV PYTHONUNBUFFERED=1 \ - PYTHONDONTWRITEBYTECODE=1 \ - PIP_NO_CACHE_DIR=off \ - PIP_DISABLE_PIP_VERSION_CHECK=on \ - PIP_DEFAULT_TIMEOUT=100 \ - POETRY_HOME="/opt/poetry" \ - POETRY_VIRTUALENVS_IN_PROJECT=true \ - POETRY_NO_INTERACTION=1 \ - PYSETUP_PATH="/opt/pysetup" \ - VENV_PATH="/opt/pysetup/.venv" - -# Prepend poetry and venv to PATH -ENV PATH="$POETRY_HOME/bin:$VENV_PATH/bin:$PATH" - -# Create user account -RUN useradd -u 911 -U -d $MEALIE_HOME -s /bin/bash abc \ - && usermod -G users abc \ - && mkdir $MEALIE_HOME - -# Builder Base Image -FROM mealie-python-base AS mealie-builder-base - -RUN apt-get update \ - && apt-get install --no-install-recommends -y \ - curl \ - build-essential \ - libpq-dev \ - libwebp-dev \ - # LDAP Dependencies - libsasl2-dev libldap2-dev libssl-dev \ - gnupg gnupg2 gnupg1 \ - && rm -rf /var/lib/apt/lists/* \ - && pip install -U --no-cache-dir pip - -# Install Poetry -ENV POETRY_VERSION=1.3.1 -RUN curl -sSL https://install.python-poetry.org | python3 - - -# Copy project requirement files -WORKDIR $PYSETUP_PATH -COPY ./poetry.lock ./pyproject.toml ./ - -# Install runtime dependencies -RUN poetry install -E pgsql --only main - -# CRFPP Image (Assuming it's needed) -FROM hkotel/crfpp AS crfpp - -RUN echo "crfpp-container" - -# Production Image -FROM mealie-python-base AS mealie-production - -LABEL org.opencontainers.image.source="https://github.com/mealie-recipes/mealie" - -ENV PRODUCTION=true -ENV TESTING=false - -ARG COMMIT -ENV GIT_COMMIT_HASH=${COMMIT} - -RUN apt-get update \ - && apt-get install --no-install-recommends -y \ - gosu \ - iproute2 \ - libldap-common \ - libldap-2.5 \ - && rm -rf /var/lib/apt/lists/* - -# Create directory for Docker Secrets -RUN mkdir -p /run/secrets - -# Copy Poetry and virtual environment from builder-base -COPY --from=mealie-builder-base $POETRY_HOME $POETRY_HOME -COPY --from=mealie-builder-base $PYSETUP_PATH $PYSETUP_PATH - -ENV LD_LIBRARY_PATH=/usr/local/lib - -# Copy CRF++ binaries -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 - -# Copy backend application -COPY ./mealie $MEALIE_HOME/mealie -COPY ./poetry.lock ./pyproject.toml $MEALIE_HOME/ - -# Alembic migrations -COPY ./alembic $MEALIE_HOME/alembic -COPY ./alembic.ini $MEALIE_HOME/ - -# Install Python runtime dependencies -WORKDIR $MEALIE_HOME -RUN . $VENV_PATH/bin/activate && poetry install -E pgsql --only main -WORKDIR / - -# Install CRF++ Models -RUN python $MEALIE_HOME/mealie/scripts/install_model.py - -# Define volumes and environment variables -VOLUME [ "$MEALIE_HOME/data/" ] -ENV APP_PORT=9000 - -EXPOSE ${APP_PORT} - -# Healthcheck -HEALTHCHECK CMD python $MEALIE_HOME/mealie/scripts/healthcheck.py || exit 1 - -# ---------------------------------- -# 6 Integrate Mealie Dockerfile - Copy Frontend - -ENV STATIC_FILES=/spa/static -COPY --from=mealie-frontend-builder /app/frontend/dist ${STATIC_FILES} - -ENV HOST=0.0.0.0 - -EXPOSE ${APP_PORT} - -# ---------------------------------- -# 7 Entrypoint and Scripts +################ +# 4 Entrypoint # +################ # Add entrypoint ENV S6_STAGE2_HOOK=/ha_entrypoint.sh @@ -225,7 +70,6 @@ ADD "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templat ADD "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/ha_entrypoint_modif.sh" "/ha_entrypoint_modif.sh" RUN chmod 777 /ha_entrypoint.sh /ha_entrypoint_modif.sh && /ha_entrypoint_modif.sh && rm /ha_entrypoint_modif.sh -# Modify run.sh for ARMv7 RUN \ # Add custom instructions to run.sh on armv7 sed -i '1d' /app/run.sh \ @@ -233,14 +77,8 @@ RUN \ && cat /run.txt > /app/run.sh \ && chmod +x /app/run.sh -# Copy and set entrypoint script -COPY ./docker/entry.sh $MEALIE_HOME/run.sh - -RUN chmod +x $MEALIE_HOME/run.sh -ENTRYPOINT ["/app/run.sh"] - ############ -# 8 Labels # +# 5 Labels # ############ ARG BUILD_ARCH @@ -270,6 +108,7 @@ LABEL \ org.opencontainers.image.version=${BUILD_VERSION} ################# -# 9 Healthcheck # +# 6 Healthcheck # ################# +# Use upstream