-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* initial commit * added squid.conf to gitignore * squid ubuntu initally commit * added squid alpine * squid alpine working - permissions open * tidied up dockerfile and removed cert logic * removed ubuntu * changed directory structure * added squid to github actions * changed entrypoint due to hadolint flag * fixed typo * combined dockerfile run stages * clean up * clean up * added labels --------- Co-authored-by: Lewis Brown <Lewis.Brown@m-gdt6n2nm91.fritz.box>
- Loading branch information
1 parent
dd63dc3
commit fce16bb
Showing
7 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,3 +70,6 @@ typings/ | |
*.tfstate | ||
*.tfstate.backup | ||
*.tfstate.lock.info | ||
|
||
# Squid config file | ||
*squid.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*squid-alpine.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
FROM alpine:3.21.0 | ||
|
||
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 \ | ||
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 | ||
RUN apk update \ | ||
&& apk --no-cache add squid=${SQUID_VERSION} \ | ||
# Create required directories and set permissions | ||
&& 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-alpine.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 | ||
|
||
# Cannot use entrypoint env var without flagging hadolint | ||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
if [[ ! -d ${SQUID_CACHE_DIR}/00 ]]; then | ||
echo "Initialising cache..." | ||
squid -N -f /etc/squid/conf.d/squid.conf -z | ||
fi | ||
echo "Starting squid..." | ||
squid -NYC -f /etc/squid/conf.d/squid.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# 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 | ||
pid_filename none | ||
logfile_rotate 0 | ||
access_log stdio:/dev/stdout | ||
cache_log stdio:/dev/stderr | ||
http_access allow all |