Dockerfile 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. # WyOJ judger image.
  2. #
  3. # Build context is this directory:
  4. # docker build -t wyoj-judger ./judger
  5. #
  6. # The base image MUST stay ubuntu:18.04. uoj_judger/include/uoj_work_path.h
  7. # selects the sandbox's syscall/readable-file whitelist with
  8. # UOJ_JUDGER_BASESYSTEM_UBUNTU1804 and UOJ_JUDGER_PYTHON3_VERSION "3.6", and
  9. # bionic is the release that actually ships python3.6 (see
  10. # uoj_judger/run/run_program_conf.h around line 362-410). A 20.04 base would
  11. # silently break Python submissions.
  12. #
  13. # This runs with judge_client's default (foreground) mode, so the container
  14. # logs go to `docker logs`; the `start` mode of judge_client daemonises into
  15. # log/judge.log and is not used here.
  16. FROM ubuntu:18.04
  17. LABEL org.opencontainers.image.source=https://git.ryp.org.cn/wyoj/wyoj-raw
  18. LABEL org.opencontainers.image.description="WyOJ Judger"
  19. LABEL org.opencontainers.image.licenses=MIT
  20. ENV DEBIAN_FRONTEND=noninteractive
  21. # python3-requests is used by judge_client; g++/make are needed both to compile
  22. # submissions and to rebuild uoj_judger during self-update (socket cmd=update).
  23. RUN apt-get update && apt-get install -y \
  24. python3 python3-requests \
  25. make g++ binutils \
  26. unzip zip \
  27. ca-certificates procps \
  28. && rm -rf /var/lib/apt/lists/*
  29. # /opt/uoj/judger must match UOJ_WORK_PATH in include/uoj_work_path.h -- the
  30. # compiled main_judger uses that absolute path at runtime.
  31. COPY . /opt/uoj/judger
  32. WORKDIR /opt/uoj/judger
  33. RUN set -eux; \
  34. chmod +x judge_client docker-entrypoint.sh register-judger.sh; \
  35. make -C uoj_judger all -j"$(nproc)"; \
  36. mkdir -p uoj_judger/work uoj_judger/result uoj_judger/data log /var/uoj_data_copy; \
  37. chmod -R 777 uoj_judger/work uoj_judger/result log
  38. ENV LANG=C.UTF-8 TZ=Asia/Shanghai
  39. # judge_client listens here for {password, cmd} tasks from
  40. # /judge/sync-judge-client (the port comes from the web's judger.socket.port).
  41. EXPOSE 2333
  42. CMD ["/opt/uoj/judger/docker-entrypoint.sh"]