Table of Contents

About

This docker file builds privoxy from source using the Debian bookworm environment.

Usage

Download the file Dockerfile to an empty directory and issue:

docker build -t TAG .

where:

Note that if the image is to be deployed to a swarm, then more than likely the image should be committed to a local registry serving the local docker swarm.

Source

FROM debian:bookworm-slim
 
# add filesystem requirements
ADD rootfs /
 
# update package manager
RUN  apt-get update -y && \
     apt-get upgrade -y && \
     apt-get dist-upgrade -y && \
     apt-get -y autoremove && \
     apt-get clean
 
# install preliminary packages
RUN apt-get install -y \
    coreutils \
    bash \
    curl \
    ca-certificates \
    build-essential \
    distcc \
    autoconf \
    automake \
    libtool \
    libpcre3 \
    libpcre3-dev \
    zlib1g-dev \
    openssl \
    libssl-dev \
    libbrotli-dev
 
# create privoxy user
RUN groupadd -g 1000 privoxy && \
    useradd -s /bin/bash -g privoxy -G privoxy -u 1000 privoxy
 
# compile dante
WORKDIR /tmp
RUN mkdir -p /tmp/build && \
  curl -o /tmp/build/privoxy.tar.gz "https://www.privoxy.org/sf-download-mirror/Sources/3.0.34%20%28stable%29/privoxy-3.0.34-stable-src.tar.gz" && \
  cd /tmp/build && \
  tar --strip=1 -xf privoxy.tar.gz && \
  export DISTCC_HOSTS="docker1.internal:35001 docker2.internal:35002 docker3.internal:35003" CC="distcc" CXX="distcc g++" && \
  autoreconf && \
  ./configure \
    --with-user=privoxy \
    --with-group=privoxy \
    --with-openssl \
    --with-brotli \
    --enable-pcre-host-patterns \
    --enable-external-filters \
    --enable-accept-filter \
    --enable-compression \
    --enable-large-file-support && \
  make -j4 && \
  make -j4 install && \
  cp config /etc/privoxy.config && \
  rm -rf /tmp/build
 
# remove packages that will not be used
WORKDIR /
RUN apt-get purge -y \
        curl \
        git \
        build-essential \
        autoconf \
        automake \
        libtool \
        distcc \
        curl \
        pkgconf && \
    apt-get autoremove -y
 
EXPOSE 8118
 
# add remaining files
ADD rootfs /
 
ENTRYPOINT [ "/bin/bash", "/usr/local/bin/run" ]