From 7aff9b411e1be2fb897b47b30b7729c5b2af32dc Mon Sep 17 00:00:00 2001 From: Lewis Brown Date: Thu, 19 Dec 2024 09:32:12 +0000 Subject: [PATCH 01/15] initial commit --- .gitignore | 3 +++ squid/ubuntu/.dockerignore | 0 squid/ubuntu/Dockerfile | 29 +++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 squid/ubuntu/.dockerignore create mode 100644 squid/ubuntu/Dockerfile diff --git a/.gitignore b/.gitignore index 72ad00e..7ea595f 100644 --- a/.gitignore +++ b/.gitignore @@ -70,3 +70,6 @@ typings/ *.tfstate *.tfstate.backup *.tfstate.lock.info + +# Squid config file +squid.conf diff --git a/squid/ubuntu/.dockerignore b/squid/ubuntu/.dockerignore new file mode 100644 index 0000000..e69de29 diff --git a/squid/ubuntu/Dockerfile b/squid/ubuntu/Dockerfile new file mode 100644 index 0000000..77d3647 --- /dev/null +++ b/squid/ubuntu/Dockerfile @@ -0,0 +1,29 @@ +FROM ubuntu:plucky-20241124 + +ENV SQUID_VERSION=6.10-1ubuntu1 \ + SQUID_LOG_DIR=/var/log/squid \ + SQUID_CACHE_DIR=/var/spool/squid \ + SQUID_USER=squid + +RUN groupadd -r ${SQUID_USER} && useradd -r -g ${SQUID_USER} ${SQUID_USER} + +#Setup non root user +#USER ${SQUID_USER} + +RUN apt-get update \ + && apt-get install -y squid=${SQUID_VERSION}* \ + && rm -rf /var/lib/apt/lists/* + +#Combine with RUN task above to optimise layer or use entry point bash script +RUN mkdir -p ${SQUID_LOG_DIR} \ + && chmod -R 755 ${SQUID_LOG_DIR} \ + && chown -R ${SQUID_USER}:${SQUID_USER} ${SQUID_LOG_DIR} \ + && mkdir -p ${SQUID_CACHE_DIR} \ + && chown -R ${SQUID_USER}:${SQUID_USER} ${SQUID_CACHE_DIR} + +# RUN which squid + +EXPOSE 3128/tcp + +#CMD [ "/usr/local/squid/sbin/squid" ] +CMD [ "/usr/sbin/squid" ] \ No newline at end of file From 9044f5d5562018ef8f54d10125b402a6692c5dab Mon Sep 17 00:00:00 2001 From: Lewis Brown Date: Thu, 19 Dec 2024 11:23:16 +0000 Subject: [PATCH 02/15] added squid.conf to gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 7ea595f..ad421e4 100644 --- a/.gitignore +++ b/.gitignore @@ -72,4 +72,4 @@ typings/ *.tfstate.lock.info # Squid config file -squid.conf +*squid.conf From ac434e427a62bca88244101e046a6e2ef42c018c Mon Sep 17 00:00:00 2001 From: Lewis Brown Date: Mon, 30 Dec 2024 15:12:23 +0000 Subject: [PATCH 03/15] squid ubuntu initally commit --- squid/ubuntu/.dockerignore | 2 ++ squid/ubuntu/Dockerfile | 25 +++++++++++++------------ squid/ubuntu/notes | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 12 deletions(-) create mode 100644 squid/ubuntu/notes diff --git a/squid/ubuntu/.dockerignore b/squid/ubuntu/.dockerignore index e69de29..f73c25c 100644 --- a/squid/ubuntu/.dockerignore +++ b/squid/ubuntu/.dockerignore @@ -0,0 +1,2 @@ +*squid.conf +*notes \ No newline at end of file diff --git a/squid/ubuntu/Dockerfile b/squid/ubuntu/Dockerfile index 77d3647..76820aa 100644 --- a/squid/ubuntu/Dockerfile +++ b/squid/ubuntu/Dockerfile @@ -3,27 +3,28 @@ FROM ubuntu:plucky-20241124 ENV SQUID_VERSION=6.10-1ubuntu1 \ SQUID_LOG_DIR=/var/log/squid \ SQUID_CACHE_DIR=/var/spool/squid \ - SQUID_USER=squid - -RUN groupadd -r ${SQUID_USER} && useradd -r -g ${SQUID_USER} ${SQUID_USER} - -#Setup non root user -#USER ${SQUID_USER} + SQUID_USER=proxy +# Install squid RUN apt-get update \ - && apt-get install -y squid=${SQUID_VERSION}* \ + && apt-get install -y squid=${SQUID_VERSION} \ && rm -rf /var/lib/apt/lists/* -#Combine with RUN task above to optimise layer or use entry point bash script +# Create required directories and set permissions RUN mkdir -p ${SQUID_LOG_DIR} \ - && chmod -R 755 ${SQUID_LOG_DIR} \ + && chmod -R 720 ${SQUID_LOG_DIR} \ && chown -R ${SQUID_USER}:${SQUID_USER} ${SQUID_LOG_DIR} \ && mkdir -p ${SQUID_CACHE_DIR} \ + && chmod -R 720 ${SQUID_CACHE_DIR} \ && chown -R ${SQUID_USER}:${SQUID_USER} ${SQUID_CACHE_DIR} -# RUN which squid +# Initialise squid cache +RUN squid -N -f /etc/squid/squid.conf -z + +# Set non root user +# A user called proxy is automatically created when installing squid +USER ${SQUID_USER} EXPOSE 3128/tcp -#CMD [ "/usr/local/squid/sbin/squid" ] -CMD [ "/usr/sbin/squid" ] \ No newline at end of file +CMD ["squid", "-NYC", "-f", "/etc/squid/squid.conf"] \ No newline at end of file diff --git a/squid/ubuntu/notes b/squid/ubuntu/notes new file mode 100644 index 0000000..5512ed4 --- /dev/null +++ b/squid/ubuntu/notes @@ -0,0 +1,38 @@ +docker run --name squid-$(jot -r 1 10000000 99999999) -d \ + --publish 3128:3128 \ + --volume /Users/Lewis.Brown/DVSA/dvsa-docker-images/squid/alpine/squid.conf:/etc/squid/squid.conf \ + --volume /srv/docker/squid/cache:/var/spool/squid \ + 53e1049b6cf1 + +docker run --name squid-$(jot -r 1 10000000 99999999) -dit --entrypoint "/bin/sh" \ + --publish 3128:3128 \ + --volume /Users/Lewis.Brown/DVSA/dvsa-docker-images/squid/alpine/squid.conf:/etc/squid/squid.conf \ + --volume /srv/docker/squid/cache:/var/spool/squid \ + ae6dcbb17972 + +docker run --name squid-$(jot -r 1 10000000 99999999) -it --entrypoint "/bin/sh" \ + --publish 3128:3128 \ + --volume /Users/Lewis.Brown/DVSA/dvsa-docker-images/squid/alpine/squid.conf:/etc/squid/conf.d/squid.conf \ + --volume /srv/docker/squid/cache:/var/spool/squid \ + 4e2744b2f28e + + +docker exec -it 2f3392c76399 "cat /var/log/squid/access.log" + +docker exec -it 0386b83d267d655cdf2c953d3bc74beedfb090b6442b30837ba20f126f567975 "/bin/sh" + +docker inspect \ + -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' b736dd41a9a7 + +nano ~/.docker/config.json + +{ + "auths": {}, + "credsStore": "osxkeychain", + "currentContext": "colima" +} + +export DOCKER_HOST="unix://${HOME}/.colima/docker.sock" + + +#RUN addgroup -S ${SQUID_USER} && adduser -S ${SQUID_USER} -G ${SQUID_USER} \ No newline at end of file From bc7e38891d22516f6fc3d5649da7690619e41111 Mon Sep 17 00:00:00 2001 From: Lewis Brown Date: Thu, 2 Jan 2025 17:19:25 +0000 Subject: [PATCH 04/15] added squid alpine --- squid/alpine/.dockerignore | 2 ++ squid/alpine/Dockerfile | 35 ++++++++++++++++++++++++++++++++++ squid/alpine/entrypoint.sh | 10 ++++++++++ squid/alpine/squid-alpine.conf | 7 +++++++ 4 files changed, 54 insertions(+) create mode 100644 squid/alpine/.dockerignore create mode 100644 squid/alpine/Dockerfile create mode 100644 squid/alpine/entrypoint.sh create mode 100755 squid/alpine/squid-alpine.conf diff --git a/squid/alpine/.dockerignore b/squid/alpine/.dockerignore new file mode 100644 index 0000000..99c2648 --- /dev/null +++ b/squid/alpine/.dockerignore @@ -0,0 +1,2 @@ +*squid-alpine.conf +*notes \ No newline at end of file diff --git a/squid/alpine/Dockerfile b/squid/alpine/Dockerfile new file mode 100644 index 0000000..63b5c9d --- /dev/null +++ b/squid/alpine/Dockerfile @@ -0,0 +1,35 @@ +FROM alpine:3.21.0 + +ENV SQUID_VERSION=changeme\ + SQUID_LOG_DIR=/var/log/squid \ + SQUID_CACHE_DIR=/var/spool/squid \ + SQUID_CONF_DIR=/etc/squid/conf.d \ + ENTRYPOINT=/usr/local/bin/entrypoint.sh \ + SQUID_USER=squid + +# Copy required scripts. The squid-docker.conf should be mounted at container runtime. +COPY entrypoint.sh ${ENTRYPOINT} + +# Install squid +RUN apk update \ + && apk --no-cache add squid ca-certificates \ + && rm -rf /var/lib/apt/lists/* + +# Create required directories and set permissions +RUN mkdir -p ${SQUID_LOG_DIR} ${SQUID_CACHE_DIR} ${SQUID_CONF_DIR} \ + && chmod -R 755 ${SQUID_LOG_DIR} ${SQUID_CACHE_DIR} ${SQUID_CONF_DIR} ${ENTRYPOINT} \ + && chown -R ${SQUID_USER}:${SQUID_USER} ${SQUID_LOG_DIR} ${SQUID_CACHE_DIR} ${SQUID_CONF_DIR} ${ENTRYPOINT} \ +# Reference squid-docker.conf in default squid.conf + && sed -i '1s;^;include /etc/squid/conf.d/*.conf\n;' /etc/squid/squid.conf + +# Set non root user +# When squid is installed a user called squid is automatically created +USER ${SQUID_USER} + +EXPOSE 3128/tcp + +ENTRYPOINT ${ENTRYPOINT} + +#TODO: +# set squid version in args and apt add +# is ca-certificates needed? \ No newline at end of file diff --git a/squid/alpine/entrypoint.sh b/squid/alpine/entrypoint.sh new file mode 100644 index 0000000..c7b1f7d --- /dev/null +++ b/squid/alpine/entrypoint.sh @@ -0,0 +1,10 @@ +#!/bin/sh +set -e + + if [[ ! -d ${SQUID_CACHE_DIR}/00 ]]; then + echo "Initialising cache..." + echo ${SQUID_CACHE_DIR} + squid -N -f /etc/squid/conf.d/squid.conf -z + fi + echo "Starting squid..." + squid -NYC -f /etc/squid/conf.d/squid.conf \ No newline at end of file diff --git a/squid/alpine/squid-alpine.conf b/squid/alpine/squid-alpine.conf new file mode 100755 index 0000000..98a42bf --- /dev/null +++ b/squid/alpine/squid-alpine.conf @@ -0,0 +1,7 @@ +acl all src all +http_access allow all +http_port 3128 +pid_filename none +logfile_rotate 0 +access_log stdio:/dev/stdout +cache_log stdio:/dev/stderr \ No newline at end of file From 4e6bde1d5ac5d5db28e3f5be60ea4d9a1c08b404 Mon Sep 17 00:00:00 2001 From: Lewis Brown Date: Fri, 3 Jan 2025 12:26:05 +0000 Subject: [PATCH 05/15] squid alpine working - permissions open --- squid/alpine/Dockerfile | 9 +++++++-- squid/alpine/squid-alpine.conf | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/squid/alpine/Dockerfile b/squid/alpine/Dockerfile index 63b5c9d..921cce8 100644 --- a/squid/alpine/Dockerfile +++ b/squid/alpine/Dockerfile @@ -1,6 +1,6 @@ FROM alpine:3.21.0 -ENV SQUID_VERSION=changeme\ +ENV SQUID_VERSION=6.12-r0 \ SQUID_LOG_DIR=/var/log/squid \ SQUID_CACHE_DIR=/var/spool/squid \ SQUID_CONF_DIR=/etc/squid/conf.d \ @@ -17,11 +17,16 @@ RUN apk update \ # Create required directories and set permissions RUN mkdir -p ${SQUID_LOG_DIR} ${SQUID_CACHE_DIR} ${SQUID_CONF_DIR} \ - && chmod -R 755 ${SQUID_LOG_DIR} ${SQUID_CACHE_DIR} ${SQUID_CONF_DIR} ${ENTRYPOINT} \ + && chmod -R 777 ${SQUID_LOG_DIR} ${SQUID_CACHE_DIR} ${SQUID_CONF_DIR} ${ENTRYPOINT} \ && chown -R ${SQUID_USER}:${SQUID_USER} ${SQUID_LOG_DIR} ${SQUID_CACHE_DIR} ${SQUID_CONF_DIR} ${ENTRYPOINT} \ # Reference squid-docker.conf in default squid.conf && sed -i '1s;^;include /etc/squid/conf.d/*.conf\n;' /etc/squid/squid.conf + COPY squid.pem /etc/squid/squid.pem + + RUN chmod 400 /etc/squid/squid.pem \ + && chown -R ${SQUID_USER}:${SQUID_USER} /etc/squid/squid.pem + # Set non root user # When squid is installed a user called squid is automatically created USER ${SQUID_USER} diff --git a/squid/alpine/squid-alpine.conf b/squid/alpine/squid-alpine.conf index 98a42bf..ecfec1f 100755 --- a/squid/alpine/squid-alpine.conf +++ b/squid/alpine/squid-alpine.conf @@ -1,7 +1,12 @@ acl all src all -http_access allow all + +#https_port 3128 tls-cert=/etc/squid/squid.pem http_port 3128 pid_filename none logfile_rotate 0 access_log stdio:/dev/stdout -cache_log stdio:/dev/stderr \ No newline at end of file +cache_log stdio:/dev/stderr +#access_log /var/log/squid/access.log +# acl hasRequest has request +# access_log daemon:/var/log/squid/access.log hasRequest +http_access allow all \ No newline at end of file From 9151da7327736234c041833cc19f5cceb77cd8a6 Mon Sep 17 00:00:00 2001 From: Lewis Brown Date: Fri, 3 Jan 2025 13:43:36 +0000 Subject: [PATCH 06/15] tidied up dockerfile and removed cert logic --- squid/alpine/Dockerfile | 17 ++++------------- squid/alpine/squid-alpine.conf | 5 ----- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/squid/alpine/Dockerfile b/squid/alpine/Dockerfile index 921cce8..eb7696b 100644 --- a/squid/alpine/Dockerfile +++ b/squid/alpine/Dockerfile @@ -7,34 +7,25 @@ ENV SQUID_VERSION=6.12-r0 \ ENTRYPOINT=/usr/local/bin/entrypoint.sh \ SQUID_USER=squid -# Copy required scripts. The squid-docker.conf should be mounted at container runtime. +# Copy required scripts. The squid-alpine.conf should be mounted to /etc/squid/conf.d/squid.conf at container runtime. COPY entrypoint.sh ${ENTRYPOINT} # Install squid RUN apk update \ - && apk --no-cache add squid ca-certificates \ + && apk --no-cache add squid=${SQUID_VERSION} \ && rm -rf /var/lib/apt/lists/* # Create required directories and set permissions RUN mkdir -p ${SQUID_LOG_DIR} ${SQUID_CACHE_DIR} ${SQUID_CONF_DIR} \ - && chmod -R 777 ${SQUID_LOG_DIR} ${SQUID_CACHE_DIR} ${SQUID_CONF_DIR} ${ENTRYPOINT} \ + && chmod -R 755 ${SQUID_LOG_DIR} ${SQUID_CACHE_DIR} ${SQUID_CONF_DIR} ${ENTRYPOINT} \ && chown -R ${SQUID_USER}:${SQUID_USER} ${SQUID_LOG_DIR} ${SQUID_CACHE_DIR} ${SQUID_CONF_DIR} ${ENTRYPOINT} \ # Reference squid-docker.conf in default squid.conf && sed -i '1s;^;include /etc/squid/conf.d/*.conf\n;' /etc/squid/squid.conf - COPY squid.pem /etc/squid/squid.pem - - RUN chmod 400 /etc/squid/squid.pem \ - && chown -R ${SQUID_USER}:${SQUID_USER} /etc/squid/squid.pem - # Set non root user # When squid is installed a user called squid is automatically created USER ${SQUID_USER} EXPOSE 3128/tcp -ENTRYPOINT ${ENTRYPOINT} - -#TODO: -# set squid version in args and apt add -# is ca-certificates needed? \ No newline at end of file +ENTRYPOINT ${ENTRYPOINT} \ No newline at end of file diff --git a/squid/alpine/squid-alpine.conf b/squid/alpine/squid-alpine.conf index ecfec1f..c2ca0d2 100755 --- a/squid/alpine/squid-alpine.conf +++ b/squid/alpine/squid-alpine.conf @@ -1,12 +1,7 @@ acl all src all - -#https_port 3128 tls-cert=/etc/squid/squid.pem http_port 3128 pid_filename none logfile_rotate 0 access_log stdio:/dev/stdout cache_log stdio:/dev/stderr -#access_log /var/log/squid/access.log -# acl hasRequest has request -# access_log daemon:/var/log/squid/access.log hasRequest http_access allow all \ No newline at end of file From 13ddb341bd1e21aa0ca092e971a4f70c1afa394b Mon Sep 17 00:00:00 2001 From: Lewis Brown Date: Fri, 3 Jan 2025 14:28:21 +0000 Subject: [PATCH 07/15] removed ubuntu --- squid/ubuntu/.dockerignore | 2 -- squid/ubuntu/Dockerfile | 30 ------------------------------ squid/ubuntu/notes | 38 -------------------------------------- 3 files changed, 70 deletions(-) delete mode 100644 squid/ubuntu/.dockerignore delete mode 100644 squid/ubuntu/Dockerfile delete mode 100644 squid/ubuntu/notes diff --git a/squid/ubuntu/.dockerignore b/squid/ubuntu/.dockerignore deleted file mode 100644 index f73c25c..0000000 --- a/squid/ubuntu/.dockerignore +++ /dev/null @@ -1,2 +0,0 @@ -*squid.conf -*notes \ No newline at end of file diff --git a/squid/ubuntu/Dockerfile b/squid/ubuntu/Dockerfile deleted file mode 100644 index 76820aa..0000000 --- a/squid/ubuntu/Dockerfile +++ /dev/null @@ -1,30 +0,0 @@ -FROM ubuntu:plucky-20241124 - -ENV SQUID_VERSION=6.10-1ubuntu1 \ - SQUID_LOG_DIR=/var/log/squid \ - SQUID_CACHE_DIR=/var/spool/squid \ - SQUID_USER=proxy - -# Install squid -RUN apt-get update \ - && apt-get install -y squid=${SQUID_VERSION} \ - && rm -rf /var/lib/apt/lists/* - -# Create required directories and set permissions -RUN mkdir -p ${SQUID_LOG_DIR} \ - && chmod -R 720 ${SQUID_LOG_DIR} \ - && chown -R ${SQUID_USER}:${SQUID_USER} ${SQUID_LOG_DIR} \ - && mkdir -p ${SQUID_CACHE_DIR} \ - && chmod -R 720 ${SQUID_CACHE_DIR} \ - && chown -R ${SQUID_USER}:${SQUID_USER} ${SQUID_CACHE_DIR} - -# Initialise squid cache -RUN squid -N -f /etc/squid/squid.conf -z - -# Set non root user -# A user called proxy is automatically created when installing squid -USER ${SQUID_USER} - -EXPOSE 3128/tcp - -CMD ["squid", "-NYC", "-f", "/etc/squid/squid.conf"] \ No newline at end of file diff --git a/squid/ubuntu/notes b/squid/ubuntu/notes deleted file mode 100644 index 5512ed4..0000000 --- a/squid/ubuntu/notes +++ /dev/null @@ -1,38 +0,0 @@ -docker run --name squid-$(jot -r 1 10000000 99999999) -d \ - --publish 3128:3128 \ - --volume /Users/Lewis.Brown/DVSA/dvsa-docker-images/squid/alpine/squid.conf:/etc/squid/squid.conf \ - --volume /srv/docker/squid/cache:/var/spool/squid \ - 53e1049b6cf1 - -docker run --name squid-$(jot -r 1 10000000 99999999) -dit --entrypoint "/bin/sh" \ - --publish 3128:3128 \ - --volume /Users/Lewis.Brown/DVSA/dvsa-docker-images/squid/alpine/squid.conf:/etc/squid/squid.conf \ - --volume /srv/docker/squid/cache:/var/spool/squid \ - ae6dcbb17972 - -docker run --name squid-$(jot -r 1 10000000 99999999) -it --entrypoint "/bin/sh" \ - --publish 3128:3128 \ - --volume /Users/Lewis.Brown/DVSA/dvsa-docker-images/squid/alpine/squid.conf:/etc/squid/conf.d/squid.conf \ - --volume /srv/docker/squid/cache:/var/spool/squid \ - 4e2744b2f28e - - -docker exec -it 2f3392c76399 "cat /var/log/squid/access.log" - -docker exec -it 0386b83d267d655cdf2c953d3bc74beedfb090b6442b30837ba20f126f567975 "/bin/sh" - -docker inspect \ - -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' b736dd41a9a7 - -nano ~/.docker/config.json - -{ - "auths": {}, - "credsStore": "osxkeychain", - "currentContext": "colima" -} - -export DOCKER_HOST="unix://${HOME}/.colima/docker.sock" - - -#RUN addgroup -S ${SQUID_USER} && adduser -S ${SQUID_USER} -G ${SQUID_USER} \ No newline at end of file From d519d99b940ca02217eca410c6e734c1ba785900 Mon Sep 17 00:00:00 2001 From: Lewis Brown Date: Fri, 3 Jan 2025 14:33:23 +0000 Subject: [PATCH 08/15] changed directory structure --- squid/6.12/.dockerignore | 1 + squid/{alpine => 6.12}/Dockerfile | 0 squid/{alpine => 6.12}/entrypoint.sh | 0 squid/{alpine => 6.12}/squid-alpine.conf | 0 squid/alpine/.dockerignore | 2 -- 5 files changed, 1 insertion(+), 2 deletions(-) create mode 100644 squid/6.12/.dockerignore rename squid/{alpine => 6.12}/Dockerfile (100%) rename squid/{alpine => 6.12}/entrypoint.sh (100%) rename squid/{alpine => 6.12}/squid-alpine.conf (100%) delete mode 100644 squid/alpine/.dockerignore diff --git a/squid/6.12/.dockerignore b/squid/6.12/.dockerignore new file mode 100644 index 0000000..91c7232 --- /dev/null +++ b/squid/6.12/.dockerignore @@ -0,0 +1 @@ +*squid-alpine.conf \ No newline at end of file diff --git a/squid/alpine/Dockerfile b/squid/6.12/Dockerfile similarity index 100% rename from squid/alpine/Dockerfile rename to squid/6.12/Dockerfile diff --git a/squid/alpine/entrypoint.sh b/squid/6.12/entrypoint.sh similarity index 100% rename from squid/alpine/entrypoint.sh rename to squid/6.12/entrypoint.sh diff --git a/squid/alpine/squid-alpine.conf b/squid/6.12/squid-alpine.conf similarity index 100% rename from squid/alpine/squid-alpine.conf rename to squid/6.12/squid-alpine.conf diff --git a/squid/alpine/.dockerignore b/squid/alpine/.dockerignore deleted file mode 100644 index 99c2648..0000000 --- a/squid/alpine/.dockerignore +++ /dev/null @@ -1,2 +0,0 @@ -*squid-alpine.conf -*notes \ No newline at end of file From b89292ef822a9b93cadcc25b24060ade3b1739ed Mon Sep 17 00:00:00 2001 From: Lewis Brown Date: Fri, 3 Jan 2025 14:37:53 +0000 Subject: [PATCH 09/15] added squid to github actions --- .github/workflows/cd.yaml | 2 ++ .github/workflows/ci.yaml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index e0d92e9..a129730 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -73,6 +73,7 @@ jobs: - php/8.2/cli - php/8.3/cli - logstash/8.16.0/batch + - squid/6.12 exclude: - base: ${{ github.event_name == 'schedule' || needs.release-please.outputs.release_created || contains(needs.orchestrator.outputs.changed-directories, 'php/8.2/fpm-nginx') && 'ignored' || 'php/8.2/fpm-nginx' }} - base: ${{ github.event_name == 'schedule' || needs.release-please.outputs.release_created || contains(needs.orchestrator.outputs.changed-directories, 'php/8.2/fpm-apache') && 'ignored' || 'php/8.2/fpm-apache' }} @@ -80,6 +81,7 @@ jobs: - base: ${{ github.event_name == 'schedule' || needs.release-please.outputs.release_created || contains(needs.orchestrator.outputs.changed-directories, 'php/8.2/cli') && 'ignored' || 'php/8.2/cli' }} - base: ${{ github.event_name == 'schedule' || needs.release-please.outputs.release_created || contains(needs.orchestrator.outputs.changed-directories, 'php/8.3/cli') && 'ignored' || 'php/8.3/cli' }} - base: ${{ github.event_name == 'schedule' || needs.release-please.outputs.release_created || contains(needs.orchestrator.outputs.changed-directories, 'logstash/8.16.0/batch') && 'ignored' || 'logstash/8.16.0/batch' }} + - base: ${{ github.event_name == 'schedule' || needs.release-please.outputs.release_created || contains(needs.orchestrator.outputs.changed-directories, 'squid/6.12') && 'ignored' || 'squid/6.12' }} uses: ./.github/workflows/docker.yaml with: image-version: ${{ (needs.release-please.outputs.release_created || github.event_name == 'schedule') && needs.release-please.outputs.tag_name || github.sha }} diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d109427..62590c4 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -39,6 +39,7 @@ jobs: - php/8.2/cli - php/8.3/cli - logstash/8.16.0/batch + - squid/6.12 exclude: - base: ${{ contains(needs.orchestrator.outputs.changed-directories, 'php/8.2/fpm-nginx') && 'ignored' || 'php/8.2/fpm-nginx' }} - base: ${{ contains(needs.orchestrator.outputs.changed-directories, 'php/8.2/fpm-apache') && 'ignored' || 'php/8.2/fpm-apache' }} @@ -46,6 +47,7 @@ jobs: - base: ${{ contains(needs.orchestrator.outputs.changed-directories, 'php/8.2/cli') && 'ignored' || 'php/8.2/cli' }} - base: ${{ contains(needs.orchestrator.outputs.changed-directories, 'php/8.3/cli') && 'ignored' || 'php/8.3/cli' }} - base: ${{ contains(needs.orchestrator.outputs.changed-directories, 'logstash/8.16.0/batch') && 'ignored' || 'logstash/8.16.0/batch' }} + - base: ${{ contains(needs.orchestrator.outputs.changed-directories, 'squid/6.12') && 'ignored' || 'squid/6.12' }} uses: ./.github/workflows/docker.yaml with: image-version: ${{ github.event.pull_request.head.sha }} From 56b21e6ba3962a2d7804c537f2fd4bf3ed7bbe90 Mon Sep 17 00:00:00 2001 From: Lewis Brown Date: Fri, 3 Jan 2025 14:54:08 +0000 Subject: [PATCH 10/15] changed entrypoint due to hadolint flag --- squid/6.12/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/squid/6.12/Dockerfile b/squid/6.12/Dockerfile index eb7696b..73ddad4 100644 --- a/squid/6.12/Dockerfile +++ b/squid/6.12/Dockerfile @@ -28,4 +28,5 @@ USER ${SQUID_USER} EXPOSE 3128/tcp -ENTRYPOINT ${ENTRYPOINT} \ No newline at end of file +# Cannot use entrypoint env var without flagged hadolint +ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] \ No newline at end of file From 0935bfe8ed7180c7edb29200c30e6dd36ebf4373 Mon Sep 17 00:00:00 2001 From: Lewis Brown Date: Fri, 3 Jan 2025 14:56:08 +0000 Subject: [PATCH 11/15] fixed typo --- squid/6.12/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/squid/6.12/Dockerfile b/squid/6.12/Dockerfile index 73ddad4..fd762ed 100644 --- a/squid/6.12/Dockerfile +++ b/squid/6.12/Dockerfile @@ -28,5 +28,5 @@ USER ${SQUID_USER} EXPOSE 3128/tcp -# Cannot use entrypoint env var without flagged hadolint +# Cannot use entrypoint env var without flagging hadolint ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] \ No newline at end of file From aac40e9221a42c86820a8e1153f3741361cebefa Mon Sep 17 00:00:00 2001 From: Lewis Brown Date: Fri, 3 Jan 2025 15:03:05 +0000 Subject: [PATCH 12/15] combined dockerfile run stages --- squid/6.12/Dockerfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/squid/6.12/Dockerfile b/squid/6.12/Dockerfile index fd762ed..694a256 100644 --- a/squid/6.12/Dockerfile +++ b/squid/6.12/Dockerfile @@ -13,10 +13,8 @@ COPY entrypoint.sh ${ENTRYPOINT} # Install squid RUN apk update \ && apk --no-cache add squid=${SQUID_VERSION} \ - && rm -rf /var/lib/apt/lists/* - # Create required directories and set permissions -RUN mkdir -p ${SQUID_LOG_DIR} ${SQUID_CACHE_DIR} ${SQUID_CONF_DIR} \ + && mkdir -p ${SQUID_LOG_DIR} ${SQUID_CACHE_DIR} ${SQUID_CONF_DIR} \ && chmod -R 755 ${SQUID_LOG_DIR} ${SQUID_CACHE_DIR} ${SQUID_CONF_DIR} ${ENTRYPOINT} \ && chown -R ${SQUID_USER}:${SQUID_USER} ${SQUID_LOG_DIR} ${SQUID_CACHE_DIR} ${SQUID_CONF_DIR} ${ENTRYPOINT} \ # Reference squid-docker.conf in default squid.conf From 03eca43f15e5b3d9709566cce5708c6852ecca96 Mon Sep 17 00:00:00 2001 From: Lewis Brown Date: Fri, 3 Jan 2025 15:07:04 +0000 Subject: [PATCH 13/15] clean up --- squid/6.12/Dockerfile | 2 +- squid/6.12/squid-alpine.conf | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/squid/6.12/Dockerfile b/squid/6.12/Dockerfile index 694a256..6814c56 100644 --- a/squid/6.12/Dockerfile +++ b/squid/6.12/Dockerfile @@ -17,7 +17,7 @@ RUN apk update \ && mkdir -p ${SQUID_LOG_DIR} ${SQUID_CACHE_DIR} ${SQUID_CONF_DIR} \ && chmod -R 755 ${SQUID_LOG_DIR} ${SQUID_CACHE_DIR} ${SQUID_CONF_DIR} ${ENTRYPOINT} \ && chown -R ${SQUID_USER}:${SQUID_USER} ${SQUID_LOG_DIR} ${SQUID_CACHE_DIR} ${SQUID_CONF_DIR} ${ENTRYPOINT} \ -# Reference squid-docker.conf in default squid.conf +# Reference squid-alpine.conf in default squid.conf && sed -i '1s;^;include /etc/squid/conf.d/*.conf\n;' /etc/squid/squid.conf # Set non root user diff --git a/squid/6.12/squid-alpine.conf b/squid/6.12/squid-alpine.conf index c2ca0d2..2e15217 100755 --- a/squid/6.12/squid-alpine.conf +++ b/squid/6.12/squid-alpine.conf @@ -1,3 +1,4 @@ +# This squid.conf allows all traffic and should only be use for testing. acl all src all http_port 3128 pid_filename none From a652e30e4898f48b6d55e6f7b19478a10de1e9f6 Mon Sep 17 00:00:00 2001 From: Lewis Brown Date: Fri, 3 Jan 2025 15:07:44 +0000 Subject: [PATCH 14/15] clean up --- squid/6.12/entrypoint.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/squid/6.12/entrypoint.sh b/squid/6.12/entrypoint.sh index c7b1f7d..faf989e 100644 --- a/squid/6.12/entrypoint.sh +++ b/squid/6.12/entrypoint.sh @@ -3,7 +3,6 @@ set -e if [[ ! -d ${SQUID_CACHE_DIR}/00 ]]; then echo "Initialising cache..." - echo ${SQUID_CACHE_DIR} squid -N -f /etc/squid/conf.d/squid.conf -z fi echo "Starting squid..." From de64837394b704899aa29e17888122ef22eb56cf Mon Sep 17 00:00:00 2001 From: Lewis Brown Date: Mon, 6 Jan 2025 15:03:59 +0000 Subject: [PATCH 15/15] added labels --- squid/6.12/Dockerfile | 9 +++++++-- squid/6.12/squid-alpine.conf | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/squid/6.12/Dockerfile b/squid/6.12/Dockerfile index 6814c56..e5e8681 100644 --- a/squid/6.12/Dockerfile +++ b/squid/6.12/Dockerfile @@ -7,10 +7,15 @@ ENV SQUID_VERSION=6.12-r0 \ ENTRYPOINT=/usr/local/bin/entrypoint.sh \ SQUID_USER=squid +LABEL title="squid-alpine" +LABEL version="1.0" +LABEL organisation="DVSA" +LABEL description="Builds Alpine Squid base image that does not include bespoke Squid.conf file. This file should be added to /etc/squid/conf.d/ directory" + # Copy required scripts. The squid-alpine.conf should be mounted to /etc/squid/conf.d/squid.conf at container runtime. COPY entrypoint.sh ${ENTRYPOINT} -# Install squid +# Install Squid RUN apk update \ && apk --no-cache add squid=${SQUID_VERSION} \ # Create required directories and set permissions @@ -21,7 +26,7 @@ RUN apk update \ && sed -i '1s;^;include /etc/squid/conf.d/*.conf\n;' /etc/squid/squid.conf # Set non root user -# When squid is installed a user called squid is automatically created +# When Squid is installed a user called squid is automatically created USER ${SQUID_USER} EXPOSE 3128/tcp diff --git a/squid/6.12/squid-alpine.conf b/squid/6.12/squid-alpine.conf index 2e15217..a533db9 100755 --- a/squid/6.12/squid-alpine.conf +++ b/squid/6.12/squid-alpine.conf @@ -1,3 +1,5 @@ +# This is a dummy squid.conf that is not included in the Docker image. +# It should be mounted in /etc/squid/conf.d # This squid.conf allows all traffic and should only be use for testing. acl all src all http_port 3128