Commit e0d667d0 authored by Jim Newsome's avatar Jim Newsome
Browse files

Use apt-cacher-ng instead of repeating package lists

parent 23395fda
Loading
Loading
Loading
Loading
+17 −40
Original line number Diff line number Diff line
FROM ubuntu:20.04 as base
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y \
  git \
  python3 \
  python3-pip

FROM base as build-c
RUN apt-get update && apt-get install -y \
  # shadow \
  cmake \
  findutils \
  libc-dbg \
  libglib2.0-0 \
  libglib2.0-dev \
  libigraph-dev \
  libprocps-dev \
  make \
  xz-utils \
  # tgen \
  cmake \
  libglib2.0-0 \
  libglib2.0-dev \
  libigraph0-dev \
  libigraph0v5 \
  # oniontrace \
  cmake libglib2.0-0 \
  libglib2.0-dev \
  # tor
  autoconf \
  automake \
  gcc \
  libevent-dev \
  libssl-dev \
  make \
  zlib1g-dev \
  # misc \
  build-essential
# https://fabianlee.org/2018/02/11/ubuntu-a-centralized-apt-package-cache-using-apt-cacher-ng/
RUN apt-get update && apt-get install -y net-tools
RUN if [[ `netstat -an | grep "LISTEN " | grep -c :3142` -gt 0 ]] ; \
    then \
      echo Will use detected apt-cacher-ng service ; \
      echo "Acquire::http::Proxy \"http://127.0.0.1:3142\";" > /etc/apt/apt.conf.d/00proxy ; \
    else \
      echo apt-cacher-ng not detected ; \
    fi
RUN apt-get update && apt-get install -y git 

# Build shadow
FROM build-c as build-shadow
FROM base as build-shadow
WORKDIR /root/src
ARG shadow_repo=https://github.com/shadow/shadow.git 
ARG shadow_branch=dev
@@ -58,7 +33,7 @@ RUN ./setup build -j`nproc` -p /opt/shadow
RUN ./setup install

# Build tgen
FROM build-c as build-tgen
FROM base as build-tgen
RUN apt-get update && apt-get install -y \
  cmake \
  libglib2.0-0 \
@@ -77,9 +52,11 @@ RUN make -j`nproc`
RUN make install

# Build oniontrace
FROM build-c as build-oniontrace
FROM base as build-oniontrace
RUN apt-get update && apt-get install -y \
  cmake libglib2.0-0 libglib2.0-dev
  cmake \
  libglib2.0-0 \
  libglib2.0-dev
WORKDIR /root/src
ARG oniontrace_repo=https://github.com/shadow/oniontrace.git
ARG oniontrace_branch=main
@@ -90,7 +67,7 @@ RUN make -j`nproc`
RUN make install

# Build tor
FROM build-c as build-tor
FROM base as build-tor
RUN apt-get update && apt-get install -y \
  autoconf \
  automake \