Skip to content

Commit

Permalink
refactor(ci): remove label from Dockerhub; use inline cache
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtemkaKun authored Oct 7, 2024
1 parent b825d0b commit f5b21cf
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build_and_push_docker_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@ jobs:
push: true
tags: "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest,
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.CURRENT_COMMIT_SHORT_HASH }}"
cache-from: "type=gha"
cache-to: "type=gha,mode=max"
cache-from: "type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest"
cache-to: "type=inline"
12 changes: 10 additions & 2 deletions .github/workflows/validate_new_changes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:

permissions:
contents: "read"
packages: "read"

env:
REGISTRY: "ghcr.io"
Expand All @@ -23,15 +24,22 @@ jobs:
- name: "Set up Docker Buildx"
uses: "docker/setup-buildx-action@v3"

- name: "Login to Docker registry"
uses: "docker/login-action@v3"
with:
registry: "${{ env.REGISTRY }}"
username: "${{ github.actor }}"
password: "${{ secrets.GITHUB_TOKEN }}"

- name: "Build YAML linter Docker image"
uses: "docker/build-push-action@v6"
with:
push: false
load: true
# NOTE: using another name to don't allow docker to download image from the internet in the next step.
tags: "local/yaml-linter-pr:latest"
cache-from: "type=gha"
cache-to: "type=gha,mode=max"
cache-from: "type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest"
cache-to: "type=inline"

- name: "Run local YAML linter"
run: "docker run --rm -v ${{ github.workspace }}:/linter_workdir/repo local/yaml-linter-pr:latest"
4 changes: 0 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
FROM python:3.12.7-alpine

LABEL org.opencontainers.image.description="This image contains preconfigured \
[YAML linter](https://github.com/adrienverge/yamllint). \
This linter is used in Articola Tools organization's repositories to lint YAML files like GitHub Actions."

RUN pip install --no-cache-dir yamllint

ADD ./ /linter_workdir
Expand Down

0 comments on commit f5b21cf

Please sign in to comment.