chore: update dockerfile

This commit is contained in:
Baoshuo Ren 2023-02-13 18:44:48 +08:00
parent 4f1c58ad23
commit 1612fa4adc
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
2 changed files with 28 additions and 26 deletions

View File

@ -1,18 +1,21 @@
FROM ubuntu:22.04 FROM ubuntu:22.04
ARG CLONE_ADDFLAG
ARG USE_MIRROR
ENV USE_MIRROR $USE_MIRROR
SHELL ["/bin/bash", "-c"] SHELL ["/bin/bash", "-c"]
ENV DEBIAN_FRONTEND=noninteractive 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 apt-get update && \
RUN if [[ "$USE_MIRROR" == "1" ]]; then\ apt-get install -y --no-install-recommends gnupg ca-certificates apt-transport-https && \
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 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) 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 ADD . /opt/uoj_judger
WORKDIR /opt/uoj_judger WORKDIR /opt/uoj_judger

View File

@ -1,24 +1,23 @@
FROM ubuntu:22.04 FROM ubuntu:22.04
ARG CLONE_ADDFLAG
ARG USE_MIRROR
ENV USE_MIRROR $USE_MIRROR
SHELL ["/bin/bash", "-c"] SHELL ["/bin/bash", "-c"]
ENV DEBIAN_FRONTEND=noninteractive 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 apt-get update && \
RUN if [[ "$USE_MIRROR" == "1" ]]; then\ apt-get install -y --no-install-recommends gnupg ca-certificates apt-transport-https && \
sed -i "s@http://.*archive.ubuntu.com@https://mirrors.aliyun.com@g" /etc/apt/sources.list &&\ (echo "deb http://ppa.launchpad.net/ondrej/php/ubuntu jammy main" | tee /etc/apt/sources.list.d/ondrej-php.list) && \
sed -i "s@http://.*security.ubuntu.com@https://mirrors.aliyun.com@g" /etc/apt/sources.list ;\ apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4F4EA0AAE5267A6C && \
fi &&\ apt-get update && \
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 &&\ 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 \
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 &&\ cnt=10 && \
if [[ "$USE_MIRROR" == "1" ]]; then\ while ! apt-get install -y "$pkg"; do \
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' {} \; &&\ if [ $cnt -le 0 ]; then \
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' {} \; ;\ echo "Failed to install $pkg" && \
fi &&\ exit 1; \
apt-get update --allow-unauthenticated &&\ fi; \
(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") cnt=$((cnt - 1)); \
done; \
done
ADD . /opt/uoj ADD . /opt/uoj
WORKDIR /opt/uoj WORKDIR /opt/uoj