mirror of
https://github.com/QingdaoU/OnlineJudge.git
synced 2024-12-27 15:41:58 +00:00
39 lines
1.1 KiB
Docker
39 lines
1.1 KiB
Docker
FROM alpine:3.19 AS downloader
|
|
|
|
WORKDIR /app
|
|
|
|
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
|
|
ARG TARGETARCH
|
|
ARG TARGETVARIANT
|
|
|
|
ENV OJ_ENV production
|
|
WORKDIR /app
|
|
|
|
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
|
|
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
|
|
pip install -r /app/deploy/requirements.txt
|
|
apk del gcc libc-dev python3-dev libpq-dev libjpeg-turbo-dev zlib-dev freetype-dev
|
|
EOS
|
|
|
|
COPY ./ /app/
|
|
COPY --from=downloader --link /app/dist/ /app/dist/
|
|
RUN chmod -R u=rwX,go=rX ./ && chmod +x ./deploy/entrypoint.sh
|
|
|
|
HEALTHCHECK --interval=5s CMD [ "/usr/local/bin/python3", "/app/deploy/health_check.py" ]
|
|
EXPOSE 8000
|
|
ENTRYPOINT [ "/app/deploy/entrypoint.sh" ]
|