2024-01-29 07:18:29 +00:00
|
|
|
FROM alpine:3.19 AS downloader
|
2017-10-23 02:47:26 +00:00
|
|
|
|
2017-11-25 05:11:24 +00:00
|
|
|
WORKDIR /app
|
2017-11-25 11:12:37 +00:00
|
|
|
|
2024-01-29 07:18:29 +00:00
|
|
|
RUN <<EOS
|
|
|
|
set -ex
|
|
|
|
apk add unzip
|
|
|
|
wget https://github.com/QingdaoU/OnlineJudgeFE/releases/download/oj_2.7.5/dist.zip
|
|
|
|
unzip dist.zip
|
|
|
|
rm -f dist.zip
|
|
|
|
EOS
|
|
|
|
|
|
|
|
FROM python:3.12-alpine
|
2024-02-07 15:34:17 +00:00
|
|
|
ARG TARGETARCH
|
|
|
|
ARG TARGETVARIANT
|
2024-01-29 07:18:29 +00:00
|
|
|
|
|
|
|
ENV OJ_ENV production
|
|
|
|
WORKDIR /app
|
2017-12-01 11:03:30 +00:00
|
|
|
|
2024-01-29 07:18:29 +00:00
|
|
|
COPY ./deploy/requirements.txt /app/deploy/
|
|
|
|
# psycopg2: libpg-dev
|
|
|
|
# pillow: libjpeg-turbo-dev zlib-dev freetype-dev
|
|
|
|
RUN --mount=type=cache,target=/etc/apk/cache,id=apk-cahce-$TARGETARCH$TARGETVARIANT-final \
|
|
|
|
--mount=type=cache,target=/root/.cache/pip,id=pip-cahce-$TARGETARCH$TARGETVARIANT-final \
|
|
|
|
<<EOS
|
|
|
|
set -ex
|
2024-01-31 09:40:07 +00:00
|
|
|
apk add gcc libc-dev python3-dev libpq libpq-dev libjpeg-turbo libjpeg-turbo-dev zlib zlib-dev freetype freetype-dev supervisor openssl nginx curl unzip
|
2024-01-29 07:18:29 +00:00
|
|
|
pip install -r /app/deploy/requirements.txt
|
|
|
|
apk del gcc libc-dev python3-dev libpq-dev libjpeg-turbo-dev zlib-dev freetype-dev
|
|
|
|
EOS
|
2017-12-04 07:29:55 +00:00
|
|
|
|
2024-01-29 07:18:29 +00:00
|
|
|
COPY ./ /app/
|
|
|
|
COPY --from=downloader --link /app/dist/ /app/dist/
|
|
|
|
RUN chmod -R u=rwX,go=rX ./ && chmod +x ./deploy/entrypoint.sh
|
2017-12-01 11:03:30 +00:00
|
|
|
|
2024-01-31 10:23:40 +00:00
|
|
|
HEALTHCHECK --interval=5s CMD [ "/usr/local/bin/python3", "/app/deploy/health_check.py" ]
|
2024-01-29 07:18:29 +00:00
|
|
|
EXPOSE 8000
|
|
|
|
ENTRYPOINT [ "/app/deploy/entrypoint.sh" ]
|