Skip to content

Commit

Permalink
fix dockerfile bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
wumingzhilian committed May 16, 2024
1 parent 1e372c7 commit b29b386
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 18 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ FROM ubuntu:22.04
ENV DEBIAN_FRONTEND noninteractive
ENV LC_CTYPE=C.UTF-8

RUN sed -i.bak 's|https\?://archive.ubuntu.com|https://mirrors.hust.edu.cn|g' /etc/apt/sources.list \
apt-get update && \
RUN sed -i.bak 's|https\?://archive.ubuntu.com|https://mirrors.hust.edu.cn|g' /etc/apt/sources.list
RUN apt-get update && \
apt-get install -y \
build-essential \
git \
Expand Down
12 changes: 6 additions & 6 deletions challenge/Dockerfile_amd64
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ RUN <<EOF
apt-get clean && rm -rf /var/lib/apt/lists/*
EOF

RUN sed -i.bak 's|https\?://archive.ubuntu.com|https://mirrors.hust.edu.cn|g' /etc/apt/sources.list
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
sed -i.bak 's|https\?://archive.ubuntu.com|https://mirrors.hust.edu.cn|g' /etc/apt/sources.list \
apt-get update && xargs apt-get install --no-install-recommends -yqq <<EOF && \
apt-get clean && rm -rf /var/lib/apt/lists/*
ca-certificates
Expand All @@ -63,9 +63,9 @@ RUN rm -f /usr/lib/python3.*/EXTERNALLY-MANAGED

FROM essentials as builder-essentials

RUN sed -i.bak 's|https\?://archive.ubuntu.com|https://mirrors.hust.edu.cn|g' /etc/apt/sources.list
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
sed -i.bak 's|https\?://archive.ubuntu.com|https://mirrors.hust.edu.cn|g' /etc/apt/sources.list \
apt-get update && xargs apt-get install --no-install-recommends -yqq <<EOF && \
apt-get clean && rm -rf /var/lib/apt/lists/*
build-essential
Expand All @@ -75,9 +75,9 @@ EOF

FROM builder-essentials as builder

RUN sed -i.bak 's|https\?://archive.ubuntu.com|https://mirrors.hust.edu.cn|g' /etc/apt/sources.list
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
sed -i.bak 's|https\?://archive.ubuntu.com|https://mirrors.hust.edu.cn|g' /etc/apt/sources.list \
apt-get update && xargs apt-get install --no-install-recommends -yqq <<EOF && \
apt-get clean && rm -rf /var/lib/apt/lists/*
autoconf
Expand Down Expand Up @@ -356,10 +356,10 @@ FROM essentials as builder-desktop-base-no
FROM essentials as builder-desktop-base-yes

ARG UBUNTU_VERSION=20.04
RUN sed -i.bak 's|https\?://archive.ubuntu.com|https://mirrors.hust.edu.cn|g' /etc/apt/sources.list
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
[ "${UBUNTU_VERSION}" == "20.04" ] && TGR=common || TGR=tools; \
sed -i.bak 's|https\?://archive.ubuntu.com|https://mirrors.hust.edu.cn|g' /etc/apt/sources.list \
apt-get update && xargs apt-get install --no-install-recommends -yqq <<EOF && \
apt-get clean && rm -rf /var/lib/apt/lists/*
novnc
Expand All @@ -378,9 +378,9 @@ FROM builder-desktop-base-${INSTALL_DESKTOP_BASE} as builder-desktop-base
FROM builder-desktop-base-no as builder-desktop-xfce-no
FROM builder-desktop-base-yes as builder-desktop-xfce-yes

RUN sed -i.bak 's|https\?://archive.ubuntu.com|https://mirrors.hust.edu.cn|g' /etc/apt/sources.list
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
sed -i.bak 's|https\?://archive.ubuntu.com|https://mirrors.hust.edu.cn|g' /etc/apt/sources.list \
apt-get update && xargs apt-get install -yqq <<EOF && \
apt-get -y remove --purge at-spi2-core tumbler gvfs-* && \
apt-get -y autoremove && \
Expand Down Expand Up @@ -465,9 +465,9 @@ FROM builder-desktop-binja-free-${INSTALL_BINJA_FREE} as builder-desktop-binja-f
FROM essentials as builder-tools-apt-no
FROM essentials as builder-tools-apt-yes

RUN sed -i.bak 's|https\?://archive.ubuntu.com|https://mirrors.hust.edu.cn|g' /etc/apt/sources.list
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
sed -i.bak 's|https\?://archive.ubuntu.com|https://mirrors.hust.edu.cn|g' /etc/apt/sources.list \
apt-get update && xargs apt-get install --no-install-recommends -yqq <<EOF && \
apt-get clean && rm -rf /var/lib/apt/lists/*
arping
Expand Down
12 changes: 6 additions & 6 deletions challenge/Dockerfile_arm64
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ RUN <<EOF
apt-get clean && rm -rf /var/lib/apt/lists/*
EOF

RUN sed -i.bak 's|https\?://archive.ubuntu.com|https://mirrors.hust.edu.cn|g' /etc/apt/sources.list
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
sed -i.bak 's|https\?://archive.ubuntu.com|https://mirrors.hust.edu.cn|g' /etc/apt/sources.list \
apt-get update && xargs apt-get install --no-install-recommends -yqq <<EOF && \
apt-get clean && rm -rf /var/lib/apt/lists/*
ca-certificates
Expand All @@ -61,9 +61,9 @@ RUN rm -f /usr/lib/python3.*/EXTERNALLY-MANAGED

FROM essentials as builder-essentials

RUN sed -i.bak 's|https\?://archive.ubuntu.com|https://mirrors.hust.edu.cn|g' /etc/apt/sources.list
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
sed -i.bak 's|https\?://archive.ubuntu.com|https://mirrors.hust.edu.cn|g' /etc/apt/sources.list \
apt-get update && xargs apt-get install --no-install-recommends -yqq <<EOF && \
apt-get clean && rm -rf /var/lib/apt/lists/*
build-essential
Expand All @@ -73,9 +73,9 @@ EOF

FROM builder-essentials as builder

RUN sed -i.bak 's|https\?://archive.ubuntu.com|https://mirrors.hust.edu.cn|g' /etc/apt/sources.list
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
sed -i.bak 's|https\?://archive.ubuntu.com|https://mirrors.hust.edu.cn|g' /etc/apt/sources.list \
apt-get update && xargs apt-get install --no-install-recommends -yqq <<EOF && \
apt-get clean && rm -rf /var/lib/apt/lists/*
autoconf
Expand Down Expand Up @@ -342,10 +342,10 @@ FROM essentials as builder-desktop-base-no
FROM essentials as builder-desktop-base-yes

ARG UBUNTU_VERSION=20.04
RUN sed -i.bak 's|https\?://archive.ubuntu.com|https://mirrors.hust.edu.cn|g' /etc/apt/sources.list
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
[ "${UBUNTU_VERSION}" == "20.04" ] && TGR=common || TGR=tools; \
sed -i.bak 's|https\?://archive.ubuntu.com|https://mirrors.hust.edu.cn|g' /etc/apt/sources.list \
apt-get update && xargs apt-get install --no-install-recommends -yqq <<EOF && \
apt-get clean && rm -rf /var/lib/apt/lists/*
novnc
Expand All @@ -364,9 +364,9 @@ FROM builder-desktop-base-${INSTALL_DESKTOP_BASE} as builder-desktop-base
FROM builder-desktop-base-no as builder-desktop-xfce-no
FROM builder-desktop-base-yes as builder-desktop-xfce-yes

RUN sed -i.bak 's|https\?://archive.ubuntu.com|https://mirrors.hust.edu.cn|g' /etc/apt/sources.list
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
sed -i.bak 's|https\?://archive.ubuntu.com|https://mirrors.hust.edu.cn|g' /etc/apt/sources.list \
apt-get update && xargs apt-get install -yqq <<EOF && \
apt-get -y remove --purge at-spi2-core tumbler gvfs-* && \
apt-get -y autoremove && \
Expand Down Expand Up @@ -412,9 +412,9 @@ FROM builder-desktop-ghidra-${INSTALL_GHIDRA} as builder-desktop-ghidra
FROM essentials as builder-tools-apt-no
FROM essentials as builder-tools-apt-yes

RUN sed -i.bak 's|https\?://archive.ubuntu.com|https://mirrors.hust.edu.cn|g' /etc/apt/sources.list
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
sed -i.bak 's|https\?://archive.ubuntu.com|https://mirrors.hust.edu.cn|g' /etc/apt/sources.list \
apt-get update && xargs apt-get install --no-install-recommends -yqq <<EOF && \
apt-get clean && rm -rf /var/lib/apt/lists/*
arping
Expand Down
8 changes: 4 additions & 4 deletions ctfd/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM python:3.9-slim-buster as build
WORKDIR /opt/CTFd

RUN sed -i.bak 's|https\?://archive.ubuntu.com|https://mirrors.hust.edu.cn|g' /etc/apt/sources.list \
apt-get update \
RUN sed -i.bak 's|https\?://archive.ubuntu.com|https://mirrors.hust.edu.cn|g' /etc/apt/sources.list
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
libffi-dev \
Expand All @@ -25,8 +25,8 @@ COPY . /opt/CTFd
FROM python:3.9-slim-buster as release
WORKDIR /opt/CTFd

RUN sed -i.bak 's|https\?://archive.ubuntu.com|https://mirrors.hust.edu.cn|g' /etc/apt/sources.list \
apt-get update \
RUN sed -i.bak 's|https\?://archive.ubuntu.com|https://mirrors.hust.edu.cn|g' /etc/apt/sources.list
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libffi6 \
libssl1.1 \
Expand Down
1 change: 1 addition & 0 deletions windows/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
FROM ubuntu:20.04 AS full

RUN sed -i.bak 's|https\?://archive.ubuntu.com|https://mirrors.hust.edu.cn|g' /etc/apt/sources.list
RUN echo 'APT::Install-Recommends 0;' >> /etc/apt/apt.conf.d/01norecommends \
&& echo 'APT::Install-Suggests 0;' >> /etc/apt/apt.conf.d/01norecommends \
&& apt-get update \
Expand Down

0 comments on commit b29b386

Please sign in to comment.