mirror of
https://github.com/super-linter/super-linter.git
synced 2024-12-22 15:22:16 -05:00
Use GitHub Action cache (#1687)
* maybe * buildx * fix order * make phar happy * have to use run * slashes * commands are hard * adding info * try load and push * only push * only load * better way * cleanup
This commit is contained in:
parent
9d4e23b7db
commit
46f72b56e8
9 changed files with 197 additions and 27 deletions
|
@ -34,6 +34,15 @@ Header() {
|
|||
info "--------------------------------------------------"
|
||||
info "----- GitHub Actions validate docker labels ------"
|
||||
info "--------------------------------------------------"
|
||||
|
||||
##################################
|
||||
# Print info on local containers #
|
||||
##################################
|
||||
info "--------------------------------------------------"
|
||||
info "Containers found locally:"
|
||||
docker images
|
||||
info "--------------------------------------------------"
|
||||
|
||||
}
|
||||
################################################################################
|
||||
#### Function ValidateLabel ####################################################
|
||||
|
|
52
.github/workflows/deploy-DEV-slim.yml
vendored
52
.github/workflows/deploy-DEV-slim.yml
vendored
|
@ -54,21 +54,53 @@ jobs:
|
|||
- name: Get current date
|
||||
run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> ${GITHUB_ENV}
|
||||
|
||||
###################################
|
||||
# Build image locally for testing #
|
||||
###################################
|
||||
########################
|
||||
# Setup Docker build X #
|
||||
########################
|
||||
- name: Setup BuildX
|
||||
uses: docker/setup-buildx-action@v1.3.0
|
||||
|
||||
##########################################
|
||||
################
|
||||
# Docker cache #
|
||||
################
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: ${{ runner.os }}-single-buildx-slim
|
||||
restore-keys: |
|
||||
${{ runner.os }}-single-buildx
|
||||
|
||||
###########################################
|
||||
# Build and Push containers to registries #
|
||||
###########################################
|
||||
- name: Build Docker image - SLIM
|
||||
uses: docker/build-push-action@v2.5.0
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile-slim
|
||||
build-args: |
|
||||
BUILD_DATE=${{ env.BUILD_DATE }}
|
||||
BUILD_REVISION=${{ github.sha }}
|
||||
BUILD_VERSION=${{ github.sha }}
|
||||
load: true
|
||||
push: false
|
||||
tags: |
|
||||
ghcr.io/github/super-linter:slim-${{ github.sha }}
|
||||
ghcr.io/github/super-linter:slim-test
|
||||
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
|
||||
#############
|
||||
# Fix Cache #
|
||||
#############
|
||||
- name: Move cache
|
||||
run: |
|
||||
docker build \
|
||||
--build-arg BUILD_DATE=${{ env.BUILD_DATE }} \
|
||||
--build-arg BUILD_REVISION=${{ github.sha }} \
|
||||
--build-arg BUILD_VERSION=${{ github.sha }} \
|
||||
-t ghcr.io/github/super-linter:slim-${{ github.sha }} \
|
||||
-t ghcr.io/github/super-linter:slim-test -f Dockerfile-slim .
|
||||
rm -rf /tmp/.buildx-cache
|
||||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
||||
|
||||
########################################
|
||||
# Validates the metadata docker labels #
|
||||
|
|
53
.github/workflows/deploy-DEV-standard.yml
vendored
53
.github/workflows/deploy-DEV-standard.yml
vendored
|
@ -54,20 +54,53 @@ jobs:
|
|||
- name: Get current date
|
||||
run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> ${GITHUB_ENV}
|
||||
|
||||
###################################
|
||||
# Build image locally for testing #
|
||||
###################################
|
||||
########################
|
||||
# Setup Docker build X #
|
||||
########################
|
||||
- name: Setup BuildX
|
||||
uses: docker/setup-buildx-action@v1.3.0
|
||||
|
||||
################
|
||||
# Docker cache #
|
||||
################
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: ${{ runner.os }}-single-buildx-standard
|
||||
restore-keys: |
|
||||
${{ runner.os }}-single-buildx
|
||||
|
||||
###########################################
|
||||
# Build and Push containers to registries #
|
||||
###########################################
|
||||
- name: Build Docker standard image
|
||||
- name: Build Docker image - Standard
|
||||
uses: docker/build-push-action@v2.5.0
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
build-args: |
|
||||
BUILD_DATE=${{ env.BUILD_DATE }}
|
||||
BUILD_REVISION=${{ github.sha }}
|
||||
BUILD_VERSION=${{ github.sha }}
|
||||
load: true
|
||||
push: false
|
||||
tags: |
|
||||
ghcr.io/github/super-linter:${{ github.sha }}
|
||||
ghcr.io/github/super-linter:test
|
||||
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
|
||||
#############
|
||||
# Fix Cache #
|
||||
#############
|
||||
- name: Move cache
|
||||
run: |
|
||||
docker build \
|
||||
--build-arg BUILD_DATE=${{ env.BUILD_DATE }} \
|
||||
--build-arg BUILD_REVISION=${{ github.sha }} \
|
||||
--build-arg BUILD_VERSION=${{ github.sha }} \
|
||||
-t ghcr.io/github/super-linter:${{ github.sha }} \
|
||||
-t ghcr.io/github/super-linter:test -f Dockerfile .
|
||||
rm -rf /tmp/.buildx-cache
|
||||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
||||
|
||||
########################################
|
||||
# Validates the metadata docker labels #
|
||||
|
|
25
.github/workflows/deploy-PROD-slim.yml
vendored
25
.github/workflows/deploy-PROD-slim.yml
vendored
|
@ -82,6 +82,17 @@ jobs:
|
|||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
env: Production-SLIM
|
||||
|
||||
################
|
||||
# Docker cache #
|
||||
################
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: ${{ runner.os }}-single-buildx-slim
|
||||
restore-keys: |
|
||||
${{ runner.os }}-single-buildx
|
||||
|
||||
###########################################
|
||||
# Build and Push containers to registries #
|
||||
###########################################
|
||||
|
@ -94,10 +105,24 @@ jobs:
|
|||
BUILD_DATE=${{ env.BUILD_DATE }}
|
||||
BUILD_REVISION=${{ github.sha }}
|
||||
BUILD_VERSION=${{ github.sha }}
|
||||
load: true
|
||||
push: true
|
||||
tags: |
|
||||
github/super-linter:slim-latest
|
||||
ghcr.io/github/super-linter:slim-latest
|
||||
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
|
||||
#############
|
||||
# Fix Cache #
|
||||
#############
|
||||
- name: Move cache
|
||||
run: |
|
||||
rm -rf /tmp/.buildx-cache
|
||||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
||||
|
||||
#######################################################
|
||||
# Create a GitHub Issue with the info from this build #
|
||||
|
|
25
.github/workflows/deploy-PROD-standard.yml
vendored
25
.github/workflows/deploy-PROD-standard.yml
vendored
|
@ -82,6 +82,17 @@ jobs:
|
|||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
env: Production
|
||||
|
||||
################
|
||||
# Docker cache #
|
||||
################
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: ${{ runner.os }}-single-buildx-standard
|
||||
restore-keys: |
|
||||
${{ runner.os }}-single-buildx
|
||||
|
||||
###########################################
|
||||
# Build and Push containers to registries #
|
||||
###########################################
|
||||
|
@ -94,10 +105,24 @@ jobs:
|
|||
BUILD_DATE=${{ env.BUILD_DATE }}
|
||||
BUILD_REVISION=${{ github.sha }}
|
||||
BUILD_VERSION=${{ github.sha }}
|
||||
load: true
|
||||
push: true
|
||||
tags: |
|
||||
github/super-linter:latest
|
||||
ghcr.io/github/super-linter:latest
|
||||
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
|
||||
#############
|
||||
# Fix Cache #
|
||||
#############
|
||||
- name: Move cache
|
||||
run: |
|
||||
rm -rf /tmp/.buildx-cache
|
||||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
||||
|
||||
#######################################################
|
||||
# Create a GitHub Issue with the info from this build #
|
||||
|
|
27
.github/workflows/deploy-RELEASE-slim.yml
vendored
27
.github/workflows/deploy-RELEASE-slim.yml
vendored
|
@ -24,7 +24,7 @@ on:
|
|||
jobs:
|
||||
deploy:
|
||||
# Name the Job
|
||||
name: Deploy Docker Image - Release - slim
|
||||
name: Deploy Docker Image - Release - SLIM
|
||||
# Set the agent to run on
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
|
@ -116,6 +116,17 @@ jobs:
|
|||
| grep -E -o "v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+")" \
|
||||
>> ${GITHUB_ENV}
|
||||
|
||||
################
|
||||
# Docker cache #
|
||||
################
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: ${{ runner.os }}-single-buildx-slim
|
||||
restore-keys: |
|
||||
${{ runner.os }}-single-buildx
|
||||
|
||||
###########################################
|
||||
# Build and Push containers to registries #
|
||||
###########################################
|
||||
|
@ -128,6 +139,7 @@ jobs:
|
|||
BUILD_DATE=${{ env.BUILD_DATE }}
|
||||
BUILD_REVISION=${{ github.sha }}
|
||||
BUILD_VERSION=${{ github.sha }}
|
||||
load: true
|
||||
push: true
|
||||
tags: |
|
||||
github/super-linter:slim-latest
|
||||
|
@ -136,6 +148,19 @@ jobs:
|
|||
ghcr.io/github/super-linter:slim-latest
|
||||
ghcr.io/github/super-linter:slim-v4
|
||||
ghcr.io/github/super-linter:slim-${{ env.RELEASE_VERSION }}
|
||||
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
|
||||
#############
|
||||
# Fix Cache #
|
||||
#############
|
||||
- name: Move cache
|
||||
run: |
|
||||
rm -rf /tmp/.buildx-cache
|
||||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
||||
|
||||
#########################
|
||||
# Update Deployment API #
|
||||
|
|
25
.github/workflows/deploy-RELEASE-standard.yml
vendored
25
.github/workflows/deploy-RELEASE-standard.yml
vendored
|
@ -123,6 +123,17 @@ jobs:
|
|||
ISSUE_TITLE: ${{ github.event.issue.title }}
|
||||
ISSUE_BODY: ${{ github.event.issue.body }}
|
||||
|
||||
################
|
||||
# Docker cache #
|
||||
################
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: ${{ runner.os }}-single-buildx-standard
|
||||
restore-keys: |
|
||||
${{ runner.os }}-single-buildx
|
||||
|
||||
###########################################
|
||||
# Build and Push containers to registries #
|
||||
###########################################
|
||||
|
@ -135,6 +146,7 @@ jobs:
|
|||
BUILD_DATE=${{ env.BUILD_DATE }}
|
||||
BUILD_REVISION=${{ github.sha }}
|
||||
BUILD_VERSION=${{ github.sha }}
|
||||
load: true
|
||||
push: true
|
||||
tags: |
|
||||
github/super-linter:latest
|
||||
|
@ -143,6 +155,19 @@ jobs:
|
|||
ghcr.io/github/super-linter:latest
|
||||
ghcr.io/github/super-linter:v4
|
||||
ghcr.io/github/super-linter:${{ env.RELEASE_VERSION }}
|
||||
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
|
||||
#############
|
||||
# Fix Cache #
|
||||
#############
|
||||
- name: Move cache
|
||||
run: |
|
||||
rm -rf /tmp/.buildx-cache
|
||||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
||||
|
||||
#############################
|
||||
# Create the GitHub Release #
|
||||
|
|
|
@ -346,9 +346,7 @@ RUN wget --tries=5 -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sger
|
|||
&& wget -q --tries=5 -O phive.phar https://phar.io/releases/phive.phar \
|
||||
&& wget -q --tries=5 -O phive.phar.asc https://phar.io/releases/phive.phar.asc \
|
||||
&& PHAR_KEY_ID="0x9D8A98B29B2D5D79" \
|
||||
&& ( gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$PHAR_KEY_ID" \
|
||||
|| gpg --keyserver pgp.mit.edu --recv-keys "$PHAR_KEY_ID" \
|
||||
|| gpg --keyserver keyserver.pgp.com --recv-keys "$PHAR_KEY_ID" ) \
|
||||
&& gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys "$PHAR_KEY_ID" \
|
||||
&& gpg --verify phive.phar.asc phive.phar \
|
||||
&& chmod +x phive.phar \
|
||||
&& mv phive.phar /usr/local/bin/phive \
|
||||
|
|
|
@ -283,9 +283,7 @@ RUN wget --tries=5 -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sger
|
|||
&& wget -q --tries=5 -O phive.phar https://phar.io/releases/phive.phar \
|
||||
&& wget -q --tries=5 -O phive.phar.asc https://phar.io/releases/phive.phar.asc \
|
||||
&& PHAR_KEY_ID="0x9D8A98B29B2D5D79" \
|
||||
&& ( gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$PHAR_KEY_ID" \
|
||||
|| gpg --keyserver pgp.mit.edu --recv-keys "$PHAR_KEY_ID" \
|
||||
|| gpg --keyserver keyserver.pgp.com --recv-keys "$PHAR_KEY_ID" ) \
|
||||
&& gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys "$PHAR_KEY_ID" \
|
||||
&& gpg --verify phive.phar.asc phive.phar \
|
||||
&& chmod +x phive.phar \
|
||||
&& mv phive.phar /usr/local/bin/phive \
|
||||
|
|
Loading…
Reference in a new issue