Update 2 files

- /squid/run.sh
- /Dockerfile
This commit is contained in:
Fred 2024-04-18 11:55:18 +00:00
parent 14160ad2d4
commit 633d4e1d09
2 changed files with 13 additions and 10 deletions

View File

@ -13,8 +13,8 @@ RUN echo "deb-src http://deb.debian.org/debian bookworm main contrib" >> /etc/ap
--program-prefix= \
--libdir=/usr/lib \
--libexecdir=/usr/lib/squid \
--localstatedir=/var \
--sharedstatedir=/usr/com \
--localstatedir=/run \
--sharedstatedir=/var/lib \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--enable-icap-client \
@ -38,7 +38,7 @@ RUN echo "deb-src http://deb.debian.org/debian bookworm main contrib" >> /etc/ap
--enable-ssl \
--enable-ssl-crtd \
--with-openssl \
--enable-storeio="aufs,diskd,ufs" \
--enable-storeio="aufs,diskd,ufs,rock" \
--exec-prefix=/usr \
--enable-auth-basic="LDAP" \
--enable-auth-digest="LDAP" \
@ -51,7 +51,7 @@ RUN echo "deb-src http://deb.debian.org/debian bookworm main contrib" >> /etc/ap
--with-filedescriptors=48000 \
--enable-delay-pools \
--with-large-files \
--with-pidfile=/squid/squid.pid \
--with-pidfile=/run/squid.pid \
--with-default-user=squid \
--enable-removal-policies="lru,heap" \
&& make \
@ -98,6 +98,7 @@ RUN adduser --no-create-home --uid 1161 --group --system squid \
&& echo "access_log stdio:/var/log/squid/access.log" >> /etc/squid/squid.conf \
&& echo "cache_log /var/log/squid/cache.log" >> /etc/squid/squid.conf \
&& echo "cache_effective_user squid" >> /etc/squid/squid.conf \
&& echo "pid_filename /run/squid.pid" >> /etc/squid/squid.conf \
# Removed in 5.8, needed for test
&& sed -i '/http_access deny all/ihttp_access allow localnet' /etc/squid/squid.conf \
# Packages dependencies installation for running and clean again
@ -110,4 +111,4 @@ HEALTHCHECK CMD squidclient mgr:info | grep "HTTP/1.1 200 OK" || exit 1
EXPOSE 3128
ENTRYPOINT ["dumb-init"]
USER squid
CMD ["bash", "-c", "/squid/run.sh && squid -N -n $HOSTNAME"]
CMD ["bash", "-c", "/squid/run.sh"]

View File

@ -1,8 +1,10 @@
#!/bin/bash
if [ -e "/squid/squid.pid" ];then
USER=$( grep -m 1 ^cache_effective_user /etc/squid/squid.conf | awk '{ print ($2) }' )
PID=$( grep -m 1 ^pid_filename /etc/squid/squid.conf | awk '{ print ($2) }' )
]
if [ -e "$PID" ];then
echo "Squid pid: Already running ?"
rm /squid/squid.pid
rm $PÏD
pkill squid
exit 1
fi
@ -17,7 +19,7 @@ else
touch "/var/spool/squid/$HOSTNAME"
fi
while test -e /tmp/$HOSTNAME.pid
while test -e $PID
do
echo "cache is generated/checked"
sleep 1
@ -42,4 +44,4 @@ fi
echo "Starting: squid"
# Run autoreload: IN BACKGROUND
/squid/autoreload.sh &
squid --foreground -N -n "$HOSTNAME"