mealie/Containerfile

94 lines
2.4 KiB
Plaintext
Raw Normal View History

2025-01-10 15:08:37 +00:00
FROM docker.io/alpine:3.21 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 \
git \
musl-dev \
gcc \
g++ \
make \
python3-dev \
openldap-dev \
zlib-dev \
jpeg-dev \
grep \
2024-04-15 14:05:42 +00:00
sed \
2025-04-24 09:03:32 +00:00
libffi-dev \
poetry
2024-04-15 13:00:23 +00:00
2025-04-24 09:03:32 +00:00
ENV FLORET_VERSION=v0.10.5
RUN git clone https://github.com/explosion/floret.git /floret
RUN cd /floret && git checkout $FLORET_VERSION
RUN sed -i '/^#include <vector>/a #include <cstdint>' /floret/src/args.h
ENV VERSION=v2.8.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
2025-04-24 09:03:32 +00:00
RUN poetry export --only=main --without-hashes --extras=pgsql --output=requirements.txt
RUN sed -i 's|floret==0.10.5 ; python_version >= "3.12" and python_version < "3.13"|floret @ file:///floret ; python_version >= "3.12" and python_version < "3.13"|' requirements.txt
RUN python3 -m venv env
RUN env/bin/pip3 install -r requirements.txt
RUN find env/bin -type f -exec grep -lZ "^#!/mealie/env/bin/python" {} + | xargs -0 -I {} sed -i "1s|^#!/mealie/env/bin/python|#!/py-pkgs/bin/python|" {}
RUN echo "/home/mealie/app/" > /mealie/env/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
2025-01-10 15:08:37 +00:00
FROM docker.io/alpine:3.21
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
2025-04-24 09:03:32 +00:00
COPY --from=builder --chown=mealie:mealie /mealie/env /py-pkgs
2024-04-15 13:00:23 +00:00
COPY --from=builder --chown=mealie:mealie /mealie/mealie /home/mealie/app/mealie
COPY --from=builder --chown=mealie:mealie /mealie/frontend/dist /home/mealie/app/static
RUN mkdir -p /app/data
RUN chown mealie:mealie /app/data
2025-04-24 09:03:32 +00:00
ENV NLTK_DATA="/nltk_data/"
RUN mkdir -p $NLTK_DATA
RUN /py-pkgs/bin/python -m nltk.downloader -d $NLTK_DATA averaged_perceptron_tagger_eng
2024-04-15 13:00:23 +00:00
ENV HOME /home/mealie/app
WORKDIR /home/mealie/app
USER mealie
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"]