2019-09-04 06:38:16 +00:00
|
|
|
name: Docker Image CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2020-02-02 15:51:35 +00:00
|
|
|
# Publish `master` as Docker `latest` image.
|
2019-09-04 06:38:16 +00:00
|
|
|
branches:
|
2020-02-02 15:51:35 +00:00
|
|
|
- master
|
2021-06-10 14:17:50 +00:00
|
|
|
|
2020-02-02 15:51:35 +00:00
|
|
|
# Publish `v1.2.3` tags as releases.
|
|
|
|
tags:
|
|
|
|
- v*
|
2021-06-10 14:17:50 +00:00
|
|
|
|
|
|
|
# Run tests for PRs to `master` branch.
|
2020-02-02 15:51:35 +00:00
|
|
|
pull_request:
|
2021-06-10 14:17:50 +00:00
|
|
|
branches:
|
|
|
|
- "master"
|
|
|
|
|
2023-03-01 12:34:59 +00:00
|
|
|
env:
|
|
|
|
TEST_TAG: b4tman/squid:test
|
|
|
|
|
2019-09-04 06:38:16 +00:00
|
|
|
jobs:
|
2021-06-10 14:17:50 +00:00
|
|
|
test:
|
|
|
|
runs-on: ubuntu-20.04
|
2019-09-04 06:38:16 +00:00
|
|
|
steps:
|
2022-04-01 03:01:50 +00:00
|
|
|
- uses: actions/checkout@v3
|
2021-06-10 14:17:50 +00:00
|
|
|
|
|
|
|
- name: Set up QEMU
|
2022-06-01 04:16:22 +00:00
|
|
|
uses: docker/setup-qemu-action@v2
|
2021-06-10 14:17:50 +00:00
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
2022-06-01 11:56:09 +00:00
|
|
|
uses: docker/setup-buildx-action@v2
|
2021-06-10 14:17:50 +00:00
|
|
|
|
|
|
|
- name: Login to DockerHub
|
|
|
|
if: github.event_name != 'pull_request'
|
2022-06-01 04:16:06 +00:00
|
|
|
uses: docker/login-action@v2
|
2021-06-10 14:17:50 +00:00
|
|
|
with:
|
|
|
|
username: b4tman
|
|
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
|
|
|
|
- name: Cache Docker layers
|
2023-03-01 03:56:59 +00:00
|
|
|
uses: actions/cache@v3.2.6
|
2021-06-10 14:17:50 +00:00
|
|
|
with:
|
|
|
|
path: /tmp/.buildx-cache
|
|
|
|
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-buildx-
|
|
|
|
|
|
|
|
- name: Build squid image
|
2023-02-01 03:00:53 +00:00
|
|
|
uses: docker/build-push-action@v4
|
2021-06-10 14:17:50 +00:00
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
push: false
|
2023-03-01 12:34:59 +00:00
|
|
|
tags: ${{ env.TEST_TAG }}
|
2021-06-10 14:17:50 +00:00
|
|
|
cache-from: type=local,src=/tmp/.buildx-cache
|
2022-02-11 11:48:38 +00:00
|
|
|
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
|
2023-03-01 12:34:59 +00:00
|
|
|
outputs: type=image,name=${{ env.TEST_TAG }},push=false
|
2021-06-10 14:17:50 +00:00
|
|
|
|
|
|
|
# Temp fix
|
|
|
|
# https://github.com/docker/build-push-action/issues/252
|
|
|
|
# https://github.com/moby/buildkit/issues/1896
|
|
|
|
- name: Move cache
|
|
|
|
run: |
|
|
|
|
rm -rf /tmp/.buildx-cache
|
|
|
|
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
|
|
|
|
|
|
|
- name: Test image
|
2023-03-01 12:53:52 +00:00
|
|
|
run: docker compose -f docker-compose.test.yml up --pull never sut
|
2023-03-01 12:34:59 +00:00
|
|
|
|
|
|
|
- name: set base image for ssl-bump
|
|
|
|
run: sed -i "s%FROM b4tman/squid%FROM $TEST_TAG%" ssl-bump/Dockerfile
|
2021-06-10 14:17:50 +00:00
|
|
|
|
|
|
|
- name: Build 'ssl-bump' image
|
2023-02-01 03:00:53 +00:00
|
|
|
uses: docker/build-push-action@v4
|
2021-06-10 14:17:50 +00:00
|
|
|
with:
|
|
|
|
context: ssl-bump
|
|
|
|
push: false
|
|
|
|
file: ssl-bump/Dockerfile
|
|
|
|
tags: b4tman/squid:ssl-bump
|
|
|
|
cache-from: type=local,src=/tmp/.buildx-cache
|
2022-02-11 11:48:38 +00:00
|
|
|
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
|
2021-06-10 14:17:50 +00:00
|
|
|
|
|
|
|
# Temp fix
|
|
|
|
# https://github.com/docker/build-push-action/issues/252
|
|
|
|
# https://github.com/moby/buildkit/issues/1896
|
|
|
|
- name: Move cache
|
|
|
|
run: |
|
|
|
|
rm -rf /tmp/.buildx-cache
|
|
|
|
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
|
|
|
|
2020-02-02 15:51:35 +00:00
|
|
|
push:
|
|
|
|
needs: test
|
2021-06-10 14:17:50 +00:00
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
if: github.event_name != 'pull_request'
|
2020-02-02 15:55:25 +00:00
|
|
|
steps:
|
2022-04-01 03:01:50 +00:00
|
|
|
- uses: actions/checkout@v3
|
2021-06-10 14:17:50 +00:00
|
|
|
|
|
|
|
- name: Docker meta
|
|
|
|
id: meta
|
2022-07-01 03:02:00 +00:00
|
|
|
uses: docker/metadata-action@v4
|
2021-06-10 14:17:50 +00:00
|
|
|
with:
|
|
|
|
images: |
|
|
|
|
b4tman/squid
|
|
|
|
ghcr.io/b4tman/squid
|
|
|
|
flavor: |
|
2021-06-10 17:11:08 +00:00
|
|
|
latest=${{ github.ref == 'refs/heads/master' }}
|
2021-06-10 14:17:50 +00:00
|
|
|
tags: |
|
|
|
|
type=ref,event=branch
|
|
|
|
type=semver,pattern={{version}}
|
|
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
|
|
|
|
|
|
- name: Docker meta (ssl-bump)
|
|
|
|
id: meta_ssl_bump
|
2022-07-01 03:02:00 +00:00
|
|
|
uses: docker/metadata-action@v4
|
2021-06-10 14:17:50 +00:00
|
|
|
with:
|
|
|
|
images: |
|
|
|
|
b4tman/squid
|
|
|
|
ghcr.io/b4tman/squid
|
|
|
|
flavor: |
|
2021-06-10 16:19:35 +00:00
|
|
|
latest=false
|
|
|
|
suffix=-ssl-bump
|
2021-06-10 14:17:50 +00:00
|
|
|
tags: |
|
|
|
|
type=ref,event=branch
|
|
|
|
type=semver,pattern={{version}}
|
|
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
|
|
|
|
|
|
- name: Docker meta (ssl-bump ghcr)
|
|
|
|
id: meta_ssl_bump_ghcr
|
2022-07-01 03:02:00 +00:00
|
|
|
uses: docker/metadata-action@v4
|
2021-06-10 14:17:50 +00:00
|
|
|
with:
|
|
|
|
images: |
|
|
|
|
ghcr.io/b4tman/squid-ssl-bump
|
|
|
|
flavor: |
|
2021-06-10 17:11:08 +00:00
|
|
|
latest=${{ github.ref == 'refs/heads/master' }}
|
2021-06-10 14:17:50 +00:00
|
|
|
tags: |
|
|
|
|
type=ref,event=branch
|
|
|
|
type=semver,pattern={{version}}
|
|
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
|
|
|
|
|
|
- name: Set up QEMU
|
2022-06-01 04:16:22 +00:00
|
|
|
uses: docker/setup-qemu-action@v2
|
2021-06-10 14:17:50 +00:00
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
2022-06-01 11:56:09 +00:00
|
|
|
uses: docker/setup-buildx-action@v2
|
2021-06-10 14:17:50 +00:00
|
|
|
|
|
|
|
- name: Cache Docker layers
|
2023-03-01 03:56:59 +00:00
|
|
|
uses: actions/cache@v3.2.6
|
2021-06-10 14:17:50 +00:00
|
|
|
with:
|
|
|
|
path: /tmp/.buildx-cache
|
|
|
|
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-buildx-
|
|
|
|
|
|
|
|
- name: Login to DockerHub
|
2022-06-01 04:16:06 +00:00
|
|
|
uses: docker/login-action@v2
|
2021-06-10 14:17:50 +00:00
|
|
|
with:
|
|
|
|
username: b4tman
|
|
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
|
|
|
|
- name: Login to GHCR
|
2022-06-01 04:16:06 +00:00
|
|
|
uses: docker/login-action@v2
|
2021-06-10 14:17:50 +00:00
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.repository_owner }}
|
|
|
|
password: ${{ secrets.CR_PAT }}
|
|
|
|
|
|
|
|
- name: Build squid image
|
2023-02-01 03:00:53 +00:00
|
|
|
uses: docker/build-push-action@v4
|
2021-06-10 14:17:50 +00:00
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
push: true
|
2021-06-10 17:13:01 +00:00
|
|
|
platforms: linux/amd64,linux/arm/v7
|
2021-06-10 14:17:50 +00:00
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
|
|
cache-from: type=local,src=/tmp/.buildx-cache
|
2022-02-11 11:48:38 +00:00
|
|
|
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
|
2021-06-10 14:17:50 +00:00
|
|
|
|
|
|
|
# Temp fix
|
|
|
|
# https://github.com/docker/build-push-action/issues/252
|
|
|
|
# https://github.com/moby/buildkit/issues/1896
|
|
|
|
- name: Move cache
|
|
|
|
run: |
|
|
|
|
rm -rf /tmp/.buildx-cache
|
|
|
|
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
|
|
|
|
|
|
|
- name: Build 'ssl-bump' image
|
2023-02-01 03:00:53 +00:00
|
|
|
uses: docker/build-push-action@v4
|
2021-06-10 14:17:50 +00:00
|
|
|
with:
|
|
|
|
context: ssl-bump
|
|
|
|
push: true
|
|
|
|
file: ssl-bump/Dockerfile
|
2021-06-10 17:13:01 +00:00
|
|
|
platforms: linux/amd64,linux/arm/v7
|
2021-06-10 14:17:50 +00:00
|
|
|
tags: ${{ steps.meta_ssl_bump.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta_ssl_bump.outputs.labels }}
|
|
|
|
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: |
|
|
|
|
rm -rf /tmp/.buildx-cache
|
|
|
|
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
|
|
|
|
|
|
|
- name: Build 'ssl-bump' image for ghcr
|
2023-02-01 03:00:53 +00:00
|
|
|
uses: docker/build-push-action@v4
|
2021-06-10 14:17:50 +00:00
|
|
|
with:
|
|
|
|
context: ssl-bump
|
|
|
|
push: true
|
|
|
|
file: ssl-bump/Dockerfile
|
|
|
|
platforms: linux/amd64,linux/arm/v7
|
|
|
|
tags: ${{ steps.meta_ssl_bump_ghcr.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta_ssl_bump_ghcr.outputs.labels }}
|
|
|
|
cache-from: type=local,src=/tmp/.buildx-cache
|
2022-02-11 11:48:38 +00:00
|
|
|
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
|
2021-06-10 14:17:50 +00:00
|
|
|
|
|
|
|
# Temp fix
|
|
|
|
# https://github.com/docker/build-push-action/issues/252
|
|
|
|
# https://github.com/moby/buildkit/issues/1896
|
|
|
|
- name: Move cache
|
|
|
|
run: |
|
|
|
|
rm -rf /tmp/.buildx-cache
|
|
|
|
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|