From 1612fa4adcc8ca15860267f634c6d6e285412c2f Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Mon, 13 Feb 2023 18:44:48 +0800 Subject: [PATCH] chore: update dockerfile --- judger/Dockerfile | 23 +++++++++++++---------- web/Dockerfile | 31 +++++++++++++++---------------- 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/judger/Dockerfile b/judger/Dockerfile index e9662af..5d821b8 100644 --- a/judger/Dockerfile +++ b/judger/Dockerfile @@ -1,18 +1,21 @@ FROM ubuntu:22.04 -ARG CLONE_ADDFLAG -ARG USE_MIRROR -ENV USE_MIRROR $USE_MIRROR SHELL ["/bin/bash", "-c"] ENV DEBIAN_FRONTEND=noninteractive -ENV PKGS="vim ntp zip unzip curl wget build-essential fp-compiler python2.7 python3.10 python3-requests libseccomp-dev openjdk-8-jdk openjdk-11-jdk openjdk-17-jdk" -RUN if [[ "$USE_MIRROR" == "1" ]]; then\ - sed -i "s@http://.*archive.ubuntu.com@http://mirrors.tuna.tsinghua.edu.cn@g" /etc/apt/sources.list &&\ - sed -i "s@http://.*security.ubuntu.com@http://mirrors.tuna.tsinghua.edu.cn@g" /etc/apt/sources.list ;\ -fi &&\ -apt-get update &&\ -(apt-get install -y --allow-unauthenticated --no-install-recommends -o Dpkg::Options::="--force-overwrite" -o APT::Acquire::Retries="30" --fix-missing $PKGS || apt --fix-broken install -y || apt-get install -y --allow-unauthenticated --no-install-recommends -o Dpkg::Options::="--force-overwrite" -o APT::Acquire::Retries="30" --fix-missing $PKGS) +RUN apt-get update && \ + apt-get install -y --no-install-recommends gnupg ca-certificates apt-transport-https && \ + apt-get update && \ + for pkg in vim ntp zip unzip curl wget build-essential fp-compiler python2.7 python3.10 python3-requests libseccomp-dev openjdk-8-jdk openjdk-11-jdk openjdk-17-jdk tzdata; do \ + cnt=10 && \ + while ! apt-get install -y "$pkg"; do \ + if [ $cnt -le 0 ]; then \ + echo "Failed to install $pkg" && \ + exit 1; \ + fi; \ + cnt=$((cnt - 1)); \ + done; \ + done ADD . /opt/uoj_judger WORKDIR /opt/uoj_judger diff --git a/web/Dockerfile b/web/Dockerfile index f687802..6a4b0f9 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -1,24 +1,23 @@ FROM ubuntu:22.04 -ARG CLONE_ADDFLAG -ARG USE_MIRROR -ENV USE_MIRROR $USE_MIRROR SHELL ["/bin/bash", "-c"] ENV DEBIAN_FRONTEND=noninteractive -ENV PKGS="php7.4 php7.4-yaml php7.4-xml php7.4-dev php7.4-zip php7.4-mysql php7.4-mbstring php7.4-gd php7.4-curl php7.4-imagick libseccomp-dev git vim ntp zip unzip curl wget apache2 libapache2-mod-xsendfile php-pear mysql-client build-essential fp-compiler re2c libseccomp-dev libyaml-dev python2.7 python3.10 python3-requests openjdk-8-jdk openjdk-11-jdk openjdk-17-jdk language-pack-zh*" -RUN if [[ "$USE_MIRROR" == "1" ]]; then\ - sed -i "s@http://.*archive.ubuntu.com@https://mirrors.aliyun.com@g" /etc/apt/sources.list &&\ - sed -i "s@http://.*security.ubuntu.com@https://mirrors.aliyun.com@g" /etc/apt/sources.list ;\ - fi &&\ - apt-get -o "Acquire::https::Verify-Peer=false" update && apt-get -o "Acquire::https::Verify-Peer=false" install -y --no-install-recommends gnupg ca-certificates &&\ - echo "deb http://ppa.launchpad.net/ondrej/php/ubuntu jammy main" | tee /etc/apt/sources.list.d/ondrej-php.list && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4F4EA0AAE5267A6C &&\ - if [[ "$USE_MIRROR" == "1" ]]; then\ - find /etc/apt/sources.list.d/ -type f -name "*.list" -exec sed -i.bak -r 's#deb(-src)?\s*http(s)?://ppa.launchpad.net#deb\1 https://launchpad.proxy.ustclug.org#ig' {} \; &&\ - find /etc/apt/sources.list.d/ -type f -name "*.list" -exec sed -i.bak -r 's#deb(-src)?\s*http(s)?://ppa.launchpadcontent.net#deb\1 https://launchpad.proxy.ustclug.org#ig' {} \; ;\ - fi &&\ - apt-get update --allow-unauthenticated &&\ - (apt-get install -y --allow-unauthenticated --no-install-recommends -o Dpkg::Options::="--force-overwrite" -o APT::Acquire::Retries="30" --fix-missing $PKGS || apt-get install --fix-broken -y -o APT::Acquire::Retries="30") +RUN apt-get update && \ + apt-get install -y --no-install-recommends gnupg ca-certificates apt-transport-https && \ + (echo "deb http://ppa.launchpad.net/ondrej/php/ubuntu jammy main" | tee /etc/apt/sources.list.d/ondrej-php.list) && \ + apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4F4EA0AAE5267A6C && \ + apt-get update && \ + for pkg in php7.4 php7.4-yaml php7.4-xml php7.4-dev php7.4-zip php7.4-mysql php7.4-mbstring php7.4-gd php7.4-curl php7.4-imagick libseccomp-dev git vim ntp zip unzip curl wget apache2 libapache2-mod-xsendfile php-pear mysql-client build-essential fp-compiler re2c libseccomp-dev libyaml-dev python2.7 python3.10 python3-requests openjdk-8-jdk openjdk-11-jdk openjdk-17-jdk language-pack-zh-hans cron tzdata; do \ + cnt=10 && \ + while ! apt-get install -y "$pkg"; do \ + if [ $cnt -le 0 ]; then \ + echo "Failed to install $pkg" && \ + exit 1; \ + fi; \ + cnt=$((cnt - 1)); \ + done; \ + done ADD . /opt/uoj WORKDIR /opt/uoj