switch docker image

This commit is contained in:
2026-06-14 09:13:05 -06:00
parent fa6736b855
commit dab6734d03
5 changed files with 270 additions and 36 deletions

View File

@@ -1,29 +1,32 @@
FROM python:3.12.2-alpine
FROM python:3.12-slim-bookworm
ARG TARGETARCH
ARG TARGETVARIANT
RUN sed -i 's|dl-cdn.alpinelinux.org|mirrors.tuna.tsinghua.edu.cn|g' /etc/apk/repositories
ENV OJ_ENV=production
WORKDIR /app
COPY ./deploy/requirements.txt /app/deploy/
RUN --mount=type=cache,target=/var/cache/apk,id=apk-cache-$TARGETARCH$TARGETVARIANT-final \
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=apt-cache-$TARGETARCH$TARGETVARIANT-final \
--mount=type=cache,target=/root/.cache/pip,id=pip-cache-$TARGETARCH$TARGETVARIANT-final \
<<EOS
set -ex
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
apk add --no-cache \
gcc libc-dev python3-dev \
libpq libpq-dev \
libjpeg-turbo libjpeg-turbo-dev \
zlib zlib-dev \
freetype freetype-dev \
supervisor openssl nginx curl unzip \
clang-extra-tools
pip install --no-cache-dir -r /app/deploy/requirements.txt
apk del gcc libc-dev python3-dev libpq-dev libjpeg-turbo-dev zlib-dev freetype-dev
apt-get update
apt-get install -y --no-install-recommends \
ca-certificates \
clang-format \
curl \
libjpeg62-turbo \
libpq5 \
nginx \
openssl \
passwd \
supervisor \
unzip \
zlib1g
pip install -r /app/deploy/requirements.txt
rm -rf /var/lib/apt/lists/*
EOS
COPY ./ /app/
@@ -33,4 +36,4 @@ RUN chmod -R u=rwX,go=rX ./ && chmod +x ./deploy/entrypoint.sh
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD python3 /app/deploy/health_check.py
EXPOSE 8000
ENTRYPOINT [ "/app/deploy/entrypoint.sh" ]
ENTRYPOINT [ "/app/deploy/entrypoint.sh" ]