mealie/Containerfile

103 lines
2.4 KiB
Plaintext
Raw Normal View History

2024-10-23 08:26:33 +00:00
FROM docker.io/alpine:3.20 AS builder
2024-04-15 13:00:23 +00:00
ENV POETRY_VIRTUALENVS_IN_PROJECT=true
ENV POETRY_NO_INTERACTION=1
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
ENV PIP_NO_CACHE_DIR=off
RUN apk --no-cache add \
yarn \
poetry \
git \
musl-dev \
gcc \
g++ \
make \
python3-dev \
openldap-dev \
zlib-dev \
jpeg-dev \
grep \
2024-04-15 14:05:42 +00:00
sed \
libffi-dev
2024-04-15 13:00:23 +00:00
2024-11-27 10:40:54 +00:00
ENV VERSION=v2.3.0
2024-04-15 13:00:23 +00:00
RUN git clone https://github.com/mealie-recipes/mealie.git
WORKDIR /mealie
RUN git checkout $VERSION
RUN poetry install -E pgsql --only main
RUN find .venv/bin -type f -exec grep -lZ "^#!/mealie/.venv/bin/python" {} + | xargs -0 -I {} sed -i "1s|^#!/mealie/.venv/bin/python|#!/py-pkgs/bin/python|" {}
2024-10-23 08:26:33 +00:00
RUN echo "/home/mealie/app/" > /mealie/.venv/lib/python3.12/site-packages/mealie.pth
2024-04-15 13:00:23 +00:00
WORKDIR /mealie/frontend
RUN yarn install \
--prefer-offline \
--frozen-lockfile \
--non-interactive \
--production=false \
--network-timeout 1000000 \
--ignore-engines
RUN echo "n" | yarn generate
2024-10-23 08:26:33 +00:00
FROM docker.io/alpine:3.20 as crfpp
2024-04-15 13:00:23 +00:00
ENV VERSION=c56dd9f29469c8a9f34456b8c0d6ae0476110516
RUN apk --no-cache add \
g++ \
make \
git
RUN git clone https://github.com/mealie-recipes/crfpp.git
WORKDIR /crfpp
RUN git checkout $VERSION
2024-04-15 14:05:42 +00:00
COPY config.guess .
COPY config.sub .
RUN ./configure --prefix=/
2024-04-15 13:00:23 +00:00
RUN make
RUN make DESTDIR=/dist install
2024-10-23 08:26:33 +00:00
FROM docker.io/alpine:3.20
2024-04-15 13:00:23 +00:00
ENV PRODUCTION=true
ENV TESTING=false
ENV PYTHONPATH=/py-pkgs
ENV PATH=$PATH:/py-pkgs/bin
ENV STATIC_FILES=/home/mealie/app/static
RUN addgroup -g 2222 mealie
RUN adduser -h /home/mealie -u 2222 -D -G mealie mealie
RUN apk add --no-cache \
python3 \
libldap \
zlib \
2024-10-23 08:26:33 +00:00
jpeg
2024-04-15 13:00:23 +00:00
COPY --from=crfpp /dist/bin /bin/
COPY --from=crfpp /dist/lib /lib/
COPY --from=builder --chown=mealie:mealie /mealie/.venv /py-pkgs
COPY --from=builder --chown=mealie:mealie /mealie/mealie /home/mealie/app/mealie
COPY --from=builder --chown=mealie:mealie /mealie/alembic.ini /home/mealie/app/alembic.ini
COPY --from=builder --chown=mealie:mealie /mealie/alembic /home/mealie/app/alembic
COPY --from=builder --chown=mealie:mealie /mealie/frontend/dist /home/mealie/app/static
RUN mkdir -p /app/data
RUN chown mealie:mealie /app/data
ENV HOME /home/mealie/app
WORKDIR /home/mealie/app
USER mealie
RUN /py-pkgs/bin/python /home/mealie/app/mealie/scripts/install_model.py
2024-10-23 08:26:33 +00:00
ENV APP_PORT=9000
ENV HOST=0.0.0.0
2024-04-15 13:00:23 +00:00
EXPOSE 9000
VOLUME ["/app/data"]
2024-10-23 08:59:35 +00:00
CMD ["/py-pkgs/bin/python", "mealie/main.py"]