Build Docker images #262
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
name: Build Docker images | |
on: | |
workflow_dispatch: null | |
schedule: | |
- cron: "55 23 * * 6" | |
permissions: | |
packages: write | |
jobs: | |
docker_sflb_ed: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- dfile: "SFLB" | |
imname: "sflb" | |
version: "3.0.15" | |
- dfile: "ED" | |
imname: "expired_domains" | |
version: "1" | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Cache Docker layers | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ matrix.imname }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ matrix.imname }}-buildx- | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: github-actions[bot] | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set date string for version | |
run: | | |
echo "version_date=$(date +'%Y%m')" >> $GITHUB_ENV | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: Dockerfile_${{ matrix.dfile }} | |
push: true | |
tags: | | |
polishfiltersteam/${{ matrix.imname }}_image:latest | |
polishfiltersteam/${{ matrix.imname }}_image:${{ matrix.version }} | |
polishfiltersteam/${{ matrix.imname }}_image:${{ matrix.version }}-${{ env.version_date }} | |
ghcr.io/filtersheroes/${{ matrix.imname }}_image:latest | |
ghcr.io/filtersheroes/${{ matrix.imname }}_image:${{ matrix.version }} | |
ghcr.io/filtersheroes/${{ matrix.imname }}_image:${{ matrix.version }}-${{ env.version_date }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max | |
- # 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 | |
docker_other: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- dfile: "KAD" | |
imname: "kad" | |
version: "3.0.15" | |
- dfile: "RTM" | |
imname: "rtm" | |
version: "3.0.15" | |
needs: docker_sflb_ed | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Cache Docker layers | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ matrix.imname }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ matrix.imname }}-buildx- | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: github-actions[bot] | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set date string for version | |
run: | | |
echo "version_date=$(date +'%Y%m')" >> $GITHUB_ENV | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: Dockerfile_${{ matrix.dfile }} | |
push: true | |
tags: | | |
polishfiltersteam/${{ matrix.imname }}_image:latest | |
polishfiltersteam/${{ matrix.imname }}_image:${{ matrix.version }} | |
polishfiltersteam/${{ matrix.imname }}_image:${{ matrix.version }}-${{ env.version_date }} | |
ghcr.io/filtersheroes/${{ matrix.imname }}_image:latest | |
ghcr.io/filtersheroes/${{ matrix.imname }}_image:${{ matrix.version }} | |
ghcr.io/filtersheroes/${{ matrix.imname }}_image:${{ matrix.version }}-${{ env.version_date }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max | |
- # 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 |