Skip to content

Commit

Permalink
imp: reduce layers
Browse files Browse the repository at this point in the history
  • Loading branch information
Tardo committed May 12, 2024
1 parent f08bcae commit d4cf373
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM alpine:latest

# Create Privoxy User
RUN set -eux; \
RUN set -ex; \
addgroup --gid 7777 --system privoxy; \
adduser \
--disabled-password \
Expand All @@ -14,7 +14,9 @@ RUN set -eux; \
mkdir /var/lib/privoxy/; \
chown privoxy:privoxy /var/lib/privoxy/;

# Install build related stuff
ARG PRIVOXY_VERSION=3.0.34

# Build Privoxy
RUN set -eux; \
apk add --no-cache --virtual build-tools \
gcc \
Expand All @@ -26,12 +28,7 @@ RUN set -eux; \
zlib-dev \
pcre-dev \
openssl-dev \
brotli-dev;

ARG PRIVOXY_VERSION=3.0.34

# Build Privoxy
RUN set -eux; \
brotli-dev; \
mkdir -p /usr/local/src/privoxy-${PRIVOXY_VERSION}-stable; \
wget -O /var/lib/privoxy/privoxy-src.tar.gz https://sourceforge.net/projects/ijbswa/files/Sources/${PRIVOXY_VERSION}%20%28stable%29/privoxy-${PRIVOXY_VERSION}-stable-src.tar.gz/download; \
tar -zxvf /var/lib/privoxy/privoxy-src.tar.gz -C /usr/local/src/; \
Expand All @@ -46,16 +43,15 @@ RUN set -eux; \
apk del build-tools;

# Add system tools
RUN set -eux; \
apk add --no-cache --virtual sys-tools \
RUN apk add --no-cache --virtual sys-tools \
openssl \
python3 \
supervisor \
bash \
sed;

# Enable Privoxy HTTPS inspection
RUN set -eux; \
RUN set -ex; \
mv /usr/local/etc/privoxy/config /usr/local/etc/privoxy/config.orig; \
sed -i '/^+set-image-blocker{pattern}/a +https-inspection \\' /usr/local/etc/privoxy/match-all.action;

Expand All @@ -69,7 +65,7 @@ COPY bin/privoxy-blocklist.sh /var/lib/privoxy/
COPY docker-entrypoint.sh /usr/local/bin/

# Set the correct permissions
RUN set -eux; \
RUN set -ex; \
mkdir -p /usr/local/etc/privoxy/CA /usr/local/etc/privoxy/certs /usr/local/etc/privoxy/privman-rules; \
chown -R privoxy:privoxy /usr/local/etc/privoxy/config /usr/local/etc/privoxy/CA /usr/local/etc/privoxy/certs /usr/local/etc/privoxy/privman-rules /var/lib/privoxy/privoxy-blocklist.conf; \
chmod a+x /var/lib/privoxy/privman.py /var/lib/privoxy/privoxy-blocklist.sh /usr/local/bin/docker-entrypoint.sh; \
Expand Down

0 comments on commit d4cf373

Please sign in to comment.