mirror of
https://github.com/b4tman/docker-squid.git
synced 2024-10-22 22:15:05 +00:00
Compare commits
No commits in common. "750d7250315220a594d8f031b736eb616c11dc36" and "3895aba33e3737cd859ba4064c0e7bbaf5f990b0" have entirely different histories.
750d725031
...
3895aba33e
69
.github/workflows/dockerimage.yml
vendored
69
.github/workflows/dockerimage.yml
vendored
@ -5,7 +5,6 @@ on:
|
||||
# Publish `master` as Docker `latest` image.
|
||||
branches:
|
||||
- master
|
||||
- v5
|
||||
|
||||
# Publish `v1.2.3` tags as releases.
|
||||
tags:
|
||||
@ -16,30 +15,27 @@ on:
|
||||
branches:
|
||||
- "master"
|
||||
|
||||
env:
|
||||
TEST_TAG: b4tman/squid:test
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
uses: docker/setup-qemu-action@v1
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
uses: docker/setup-buildx-action@v1
|
||||
|
||||
- name: Login to DockerHub
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@v2
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: b4tman
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v3.3.1
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||
@ -47,14 +43,14 @@ jobs:
|
||||
${{ runner.os }}-buildx-
|
||||
|
||||
- name: Build squid image
|
||||
uses: docker/build-push-action@v4
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
push: false
|
||||
load: true # automatically load the single-platform build result to docker images
|
||||
tags: ${{ env.TEST_TAG }}
|
||||
tags: b4tman/squid
|
||||
cache-from: type=local,src=/tmp/.buildx-cache
|
||||
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
|
||||
cache-to: type=local,dest=/tmp/.buildx-cache-new
|
||||
outputs: type=image,name=b4tman/squid,push=false
|
||||
|
||||
# Temp fix
|
||||
# https://github.com/docker/build-push-action/issues/252
|
||||
@ -65,23 +61,36 @@ jobs:
|
||||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
||||
|
||||
- name: Test image
|
||||
run: docker compose -f docker-compose.test.yml up --pull never sut
|
||||
run: docker-compose -f docker-compose.test.yml up sut
|
||||
|
||||
- name: Build 'ssl-bump' image
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: ssl-bump
|
||||
push: false
|
||||
file: ssl-bump/Dockerfile
|
||||
tags: b4tman/squid:ssl-bump
|
||||
cache-from: type=local,src=/tmp/.buildx-cache
|
||||
cache-to: type=local,dest=/tmp/.buildx-cache-new
|
||||
|
||||
# Temp fix
|
||||
# https://github.com/docker/build-push-action/issues/252
|
||||
# https://github.com/moby/buildkit/issues/1896
|
||||
- name: Move cache
|
||||
run: |
|
||||
sed -i "s%FROM b4tman/squid%FROM $TEST_TAG%" ssl-bump/Dockerfile
|
||||
docker build ssl-bump
|
||||
rm -rf /tmp/.buildx-cache
|
||||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
||||
|
||||
push:
|
||||
needs: test
|
||||
runs-on: ubuntu-20.04
|
||||
if: github.event_name != 'pull_request'
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
uses: docker/metadata-action@v3
|
||||
with:
|
||||
images: |
|
||||
b4tman/squid
|
||||
@ -95,7 +104,7 @@ jobs:
|
||||
|
||||
- name: Docker meta (ssl-bump)
|
||||
id: meta_ssl_bump
|
||||
uses: docker/metadata-action@v4
|
||||
uses: docker/metadata-action@v3
|
||||
with:
|
||||
images: |
|
||||
b4tman/squid
|
||||
@ -110,7 +119,7 @@ jobs:
|
||||
|
||||
- name: Docker meta (ssl-bump ghcr)
|
||||
id: meta_ssl_bump_ghcr
|
||||
uses: docker/metadata-action@v4
|
||||
uses: docker/metadata-action@v3
|
||||
with:
|
||||
images: |
|
||||
ghcr.io/b4tman/squid-ssl-bump
|
||||
@ -122,13 +131,13 @@ jobs:
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
uses: docker/setup-qemu-action@v1
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
uses: docker/setup-buildx-action@v1
|
||||
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v3.3.1
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||
@ -136,20 +145,20 @@ jobs:
|
||||
${{ runner.os }}-buildx-
|
||||
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v2
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: b4tman
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Login to GHCR
|
||||
uses: docker/login-action@v2
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.CR_PAT }}
|
||||
|
||||
- name: Build squid image
|
||||
uses: docker/build-push-action@v4
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
@ -157,7 +166,7 @@ jobs:
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=local,src=/tmp/.buildx-cache
|
||||
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
|
||||
cache-to: type=local,dest=/tmp/.buildx-cache-new
|
||||
|
||||
# Temp fix
|
||||
# https://github.com/docker/build-push-action/issues/252
|
||||
@ -168,7 +177,7 @@ jobs:
|
||||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
||||
|
||||
- name: Build 'ssl-bump' image
|
||||
uses: docker/build-push-action@v4
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: ssl-bump
|
||||
push: true
|
||||
@ -188,7 +197,7 @@ jobs:
|
||||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
||||
|
||||
- name: Build 'ssl-bump' image for ghcr
|
||||
uses: docker/build-push-action@v4
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: ssl-bump
|
||||
push: true
|
||||
@ -197,7 +206,7 @@ jobs:
|
||||
tags: ${{ steps.meta_ssl_bump_ghcr.outputs.tags }}
|
||||
labels: ${{ steps.meta_ssl_bump_ghcr.outputs.labels }}
|
||||
cache-from: type=local,src=/tmp/.buildx-cache
|
||||
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
|
||||
cache-to: type=local,dest=/tmp/.buildx-cache-new
|
||||
|
||||
# Temp fix
|
||||
# https://github.com/docker/build-push-action/issues/252
|
||||
|
28
.github/workflows/stale.yml
vendored
28
.github/workflows/stale.yml
vendored
@ -1,28 +0,0 @@
|
||||
# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time.
|
||||
#
|
||||
# You can adjust the behavior by modifying this file.
|
||||
# For more information, see:
|
||||
# https://github.com/actions/stale
|
||||
name: Mark stale issues and pull requests
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 1 * * *'
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
|
||||
steps:
|
||||
- uses: actions/stale@v8
|
||||
with:
|
||||
days-before-stale: 182
|
||||
days-before-close: 7
|
||||
stale-issue-message: 'Marking stale due to inactivity. Remove stale label or comment or this will be closed in 7 days.'
|
||||
close-issue-message: 'Closing due to inactivity.'
|
||||
stale-pr-message: 'Marking stale due to inactivity. Remove stale label or comment or this will be closed in 7 days.'
|
||||
close-pr-message: 'Closing due to inactivity.'
|
73
Dockerfile
73
Dockerfile
@ -1,6 +1,11 @@
|
||||
FROM alpine:3.17.3 as build
|
||||
FROM alpine:3.14.0 as build
|
||||
|
||||
ARG SQUID_VER=5.9
|
||||
ENV SQUID_VER 5.1
|
||||
|
||||
# fix conflict with libretls and libressl
|
||||
RUN set -x && \
|
||||
apk add --no-cache libretls && \
|
||||
apk upgrade --no-cache libretls
|
||||
|
||||
RUN set -x && \
|
||||
apk add --no-cache \
|
||||
@ -9,8 +14,7 @@ RUN set -x && \
|
||||
libc-dev \
|
||||
curl \
|
||||
gnupg \
|
||||
openssl-dev \
|
||||
openssl-libs-static \
|
||||
libressl-dev \
|
||||
perl-dev \
|
||||
autoconf \
|
||||
automake \
|
||||
@ -21,33 +25,32 @@ RUN set -x && \
|
||||
libcap-dev \
|
||||
linux-headers
|
||||
|
||||
WORKDIR /tmp/build
|
||||
|
||||
RUN set -x && \
|
||||
mkdir -p /tmp/build && \
|
||||
cd /tmp/build && \
|
||||
curl -SsL http://www.squid-cache.org/Versions/v${SQUID_VER%%.*}/squid-${SQUID_VER}.tar.gz -o squid-${SQUID_VER}.tar.gz && \
|
||||
curl -SsL http://www.squid-cache.org/Versions/v${SQUID_VER%%.*}/squid-${SQUID_VER}.tar.gz.asc -o squid-${SQUID_VER}.tar.gz.asc
|
||||
|
||||
COPY squid-keys.asc /tmp/build
|
||||
COPY squid-keys.asc /tmp
|
||||
|
||||
RUN set -x && \
|
||||
GNUPGHOME="$(mktemp -d)" && \
|
||||
export GNUPGHOME && \
|
||||
gpg --import squid-keys.asc && \
|
||||
cd /tmp/build && \
|
||||
export GNUPGHOME="$(mktemp -d)" && \
|
||||
gpg --import /tmp/squid-keys.asc && \
|
||||
gpg --batch --verify squid-${SQUID_VER}.tar.gz.asc squid-${SQUID_VER}.tar.gz && \
|
||||
rm -rf "$GNUPGHOME"
|
||||
|
||||
RUN set -x && \
|
||||
cd /tmp/build && \
|
||||
tar --strip 1 -xzf squid-${SQUID_VER}.tar.gz && \
|
||||
\
|
||||
MACHINE=$(uname -m) && \
|
||||
\
|
||||
CFLAGS="-g0 -O2" \
|
||||
CXXFLAGS="-g0 -O2" \
|
||||
LDFLAGS="-s" \
|
||||
\
|
||||
./configure \
|
||||
--build="$MACHINE" \
|
||||
--host="$MACHINE" \
|
||||
--build="$(uname -m)" \
|
||||
--host="$(uname -m)" \
|
||||
--prefix=/usr \
|
||||
--datadir=/usr/share/squid \
|
||||
--sysconfdir=/etc/squid \
|
||||
@ -58,8 +61,7 @@ RUN set -x && \
|
||||
--disable-arch-native \
|
||||
--enable-removal-policies="lru,heap" \
|
||||
--enable-auth-digest \
|
||||
--enable-auth-basic="getpwnam,NCSA,DB" \
|
||||
--enable-basic-auth-helpers="DB" \
|
||||
--enable-auth-basic="getpwnam,NCSA" \
|
||||
--enable-epoll \
|
||||
--enable-external-acl-helpers="file_userip,unix_group,wbinfo_group" \
|
||||
--enable-auth-ntlm="fake" \
|
||||
@ -93,20 +95,22 @@ RUN set -x && \
|
||||
--with-openssl \
|
||||
--with-pidfile=/var/run/squid/squid.pid
|
||||
|
||||
# fix build
|
||||
RUN set -x && \
|
||||
nproc=$(n=$(nproc) ; max_n=6 ; echo $(( n <= max_n ? n : max_n )) ) && \
|
||||
mkdir -p /tmp/build/tools/squidclient/tests && \
|
||||
mkdir -p /tmp/build/tools/tests
|
||||
|
||||
RUN set -x && \
|
||||
cd /tmp/build && \
|
||||
nproc=$(n=$(nproc) ; max_n=6 ; [ $n -le $max_n ] && echo $n || echo $max_n) && \
|
||||
make -j $nproc && \
|
||||
make install
|
||||
make install && \
|
||||
cd tools/squidclient && make && make install-strip
|
||||
|
||||
WORKDIR /tmp/build/tools/squidclient
|
||||
RUN make && make install-strip
|
||||
RUN sed -i '1s;^;include /etc/squid/conf.d/*.conf\n;' /etc/squid/squid.conf
|
||||
RUN echo 'include /etc/squid/conf.d.tail/*.conf' >> /etc/squid/squid.conf
|
||||
|
||||
RUN sed -i '1s;^;include /etc/squid/conf.d/*.conf\n;' /etc/squid/squid.conf && \
|
||||
echo 'include /etc/squid/conf.d.tail/*.conf' >> /etc/squid/squid.conf
|
||||
|
||||
# --- --- --- --- --- --- --- --- ---
|
||||
|
||||
FROM alpine:3.17.3
|
||||
FROM alpine:3.14.0
|
||||
|
||||
ENV SQUID_CONFIG_FILE /etc/squid/squid.conf
|
||||
ENV TZ Europe/Moscow
|
||||
@ -115,10 +119,17 @@ RUN set -x && \
|
||||
deluser squid 2>/dev/null; delgroup squid 2>/dev/null; \
|
||||
addgroup -S squid -g 3128 && adduser -S -u 3128 -G squid -g squid -H -D -s /bin/false -h /var/cache/squid squid
|
||||
|
||||
# fix conflict with libretls and libressl
|
||||
RUN set -x && \
|
||||
apk add --no-cache libretls && \
|
||||
apk upgrade --no-cache libretls
|
||||
|
||||
RUN apk add --no-cache \
|
||||
libstdc++ \
|
||||
heimdal-libs \
|
||||
libcap \
|
||||
libressl3.3-libcrypto \
|
||||
libressl3.3-libssl \
|
||||
libltdl
|
||||
|
||||
COPY --from=build /etc/squid/ /etc/squid/
|
||||
@ -127,15 +138,17 @@ COPY --from=build /usr/share/squid/ /usr/share/squid/
|
||||
COPY --from=build /usr/sbin/squid /usr/sbin/squid
|
||||
COPY --from=build /usr/bin/squidclient /usr/bin/squidclient
|
||||
|
||||
|
||||
RUN install -d -o squid -g squid \
|
||||
/var/cache/squid \
|
||||
/var/log/squid \
|
||||
/var/run/squid && \
|
||||
chmod +x /usr/lib/squid/* && \
|
||||
install -d -m 755 -o squid -g squid \
|
||||
chmod +x /usr/lib/squid/*
|
||||
|
||||
RUN install -d -m 755 -o squid -g squid \
|
||||
/etc/squid/conf.d \
|
||||
/etc/squid/conf.d.tail && \
|
||||
touch /etc/squid/conf.d/placeholder.conf
|
||||
/etc/squid/conf.d.tail
|
||||
RUN touch /etc/squid/conf.d/placeholder.conf
|
||||
COPY squid-log.conf /etc/squid/conf.d.tail/
|
||||
|
||||
RUN set -x && \
|
||||
|
@ -1,3 +1,5 @@
|
||||
[![Drone Build Status](https://cloud.drone.io/api/badges/b4tman/docker-squid/status.svg?ref=refs/heads/master)](https://cloud.drone.io/b4tman/docker-squid)
|
||||
![Docker Build Status](https://img.shields.io/docker/cloud/build/b4tman/squid)
|
||||
![Docker Image CI Status](https://github.com/b4tman/docker-squid/workflows/Docker%20Image%20CI/badge.svg)
|
||||
|
||||
# docker-squid
|
||||
|
@ -1,7 +1,10 @@
|
||||
version: '2.3'
|
||||
services:
|
||||
proxy:
|
||||
image: "${TEST_TAG}"
|
||||
image: squidproxy
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
healthcheck:
|
||||
test: ["CMD", "sh", "-exc", "squidclient -T 3 mgr:info 2> /dev/null | grep -qF '200 OK'"]
|
||||
interval: 5s
|
||||
@ -9,10 +12,9 @@ services:
|
||||
retries: 5
|
||||
start_period: 1s
|
||||
sut:
|
||||
image: "${TEST_TAG}"
|
||||
image: squidproxy
|
||||
links:
|
||||
- proxy
|
||||
depends_on:
|
||||
- proxy
|
||||
command: sh -exc "sleep 10 && squidclient -h proxy -T 3 'https://postman-echo.com/get?squidtest=ok' 2> /dev/null | grep -qF '200 OK'"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user