Skip to content

Commit

Permalink
adjust Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
MeetWq committed May 4, 2024
1 parent 4d67fd5 commit c8c2659
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ FROM python:3.10 as tmp

WORKDIR /tmp

RUN curl -sSL https://install.python-poetry.org | python -

ENV PATH="${PATH}:/root/.local/bin"

COPY ./pyproject.toml ./poetry.lock* /tmp/
RUN pip install poetry \
&& poetry config virtualenvs.in-project true \
&& poetry install --only main --no-interaction --no-ansi

RUN poetry export -f requirements.txt --output requirements.txt --without-hashes

FROM python:3.10-slim as app

Expand All @@ -17,20 +18,8 @@ EXPOSE 2233

VOLUME /data

COPY --from=tmp /tmp/.venv /app/.venv

COPY ./resources/fonts/* /usr/share/fonts/meme-fonts/
RUN apt-get update \
&& apt-get install -y --no-install-recommends locales fontconfig fonts-noto-color-emoji gettext \
&& localedef -i zh_CN -c -f UTF-8 -A /usr/share/locale/locale.alias zh_CN.UTF-8 \
&& fc-cache -fv \
&& apt-get purge -y --auto-remove \
&& rm -rf /var/lib/apt/lists/*

ENV TZ=Asia/Shanghai \
LC_ALL=zh_CN.UTF-8 \
PATH="/app/.venv/bin:${PATH}" \
VIRTUAL_ENV="/app/.venv" \
LOAD_BUILTIN_MEMES=true \
MEME_DIRS="[\"/data/memes\"]" \
MEME_DISABLED_LIST="[]" \
Expand All @@ -40,6 +29,18 @@ ENV TZ=Asia/Shanghai \
BAIDU_TRANS_APIKEY="" \
LOG_LEVEL="INFO"

COPY --from=tmp /tmp/requirements.txt /app/requirements.txt

COPY ./resources/fonts/* /usr/share/fonts/meme-fonts/

RUN apt-get update \
&& apt-get install -y --no-install-recommends locales fontconfig fonts-noto-color-emoji gettext \
&& localedef -i zh_CN -c -f UTF-8 -A /usr/share/locale/locale.alias zh_CN.UTF-8 \
&& fc-cache -fv \
&& apt-get purge -y --auto-remove \
&& rm -rf /var/lib/apt/lists/* \
&& pip install --no-cache-dir --upgrade -r /app/requirements.txt

COPY ./meme_generator /app/meme_generator

COPY ./docker/config.toml.template /app/config.toml.template
Expand Down

0 comments on commit c8c2659

Please sign in to comment.