Skip to content

Commit

Permalink
Squash docker images to have less layers and size (#4170)
Browse files Browse the repository at this point in the history
  • Loading branch information
nvuillam authored Oct 20, 2024
1 parent 7ab9a2e commit e13ac87
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/deploy-ALPHA-flavors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ jobs:
BUILD_DATE=${{ env.BUILD_DATE }}
BUILD_REVISION=${{ github.sha }}
BUILD_VERSION=alpha
--squash # Enable image squashing to produce a single-layer image
load: false
push: true
secrets: |
Expand All @@ -128,6 +129,7 @@ jobs:
BUILD_DATE=${{ env.BUILD_DATE }}
BUILD_REVISION=${{ github.sha }}
BUILD_VERSION=alpha
--squash # Enable image squashing to produce a single-layer image
load: false
push: true
secrets: |
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/deploy-ALPHA.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ jobs:
BUILD_DATE=${{ env.BUILD_DATE }}
BUILD_REVISION=${{ github.sha }}
BUILD_VERSION=alpha
--squash # Enable image squashing to produce a single-layer image
load: false
push: true
secrets: |
Expand All @@ -117,6 +118,7 @@ jobs:
BUILD_DATE=${{ env.BUILD_DATE }}
BUILD_REVISION=${{ github.sha }}
BUILD_VERSION=alpha
--squash # Enable image squashing to produce a single-layer image
load: false
push: true
secrets: |
Expand All @@ -136,6 +138,7 @@ jobs:
BUILD_DATE=${{ env.BUILD_DATE }}
BUILD_REVISION=${{ github.sha }}
BUILD_VERSION=alpha
--squash # Enable image squashing to produce a single-layer image
load: false
push: true
secrets: |
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/deploy-BETA-flavors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ jobs:
BUILD_DATE=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
BUILD_VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
BUILD_REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
--squash # Enable image squashing to produce a single-layer image
load: false
push: ${{ github.event_name != 'pull_request' }}
secrets: |
Expand All @@ -193,6 +194,7 @@ jobs:
BUILD_DATE=${{ fromJSON(steps.meta-w.outputs.json).labels['org.opencontainers.image.created'] }}
BUILD_VERSION=${{ fromJSON(steps.meta-w.outputs.json).labels['org.opencontainers.image.version'] }}
BUILD_REVISION=${{ fromJSON(steps.meta-w.outputs.json).labels['org.opencontainers.image.revision'] }}
--squash # Enable image squashing to produce a single-layer image
load: false
push: ${{ github.event_name != 'pull_request' }}
secrets: |
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/deploy-BETA-linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ jobs:
BUILD_DATE=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
BUILD_VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
BUILD_REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
--squash # Enable image squashing to produce a single-layer image
load: false
push: ${{ github.event_name != 'pull_request' }}
secrets: |
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/deploy-BETA.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ jobs:
BUILD_DATE=${{ fromJSON(steps.meta-s.outputs.json).labels['org.opencontainers.image.created'] }}
BUILD_VERSION=${{ fromJSON(steps.meta-s.outputs.json).labels['org.opencontainers.image.version'] }}
BUILD_REVISION=${{ fromJSON(steps.meta-s.outputs.json).labels['org.opencontainers.image.revision'] }}
--squash # Enable image squashing to produce a single-layer image
load: false
push: ${{ github.event_name != 'pull_request' }}
secrets: |
Expand All @@ -179,6 +180,7 @@ jobs:
BUILD_DATE=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
BUILD_VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
BUILD_REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
--squash # Enable image squashing to produce a single-layer image
load: false
push: ${{ github.event_name != 'pull_request' }}
secrets: |
Expand All @@ -202,6 +204,7 @@ jobs:
BUILD_DATE=${{ fromJSON(steps.meta-w.outputs.json).labels['org.opencontainers.image.created'] }}
BUILD_VERSION=${{ fromJSON(steps.meta-w.outputs.json).labels['org.opencontainers.image.version'] }}
BUILD_REVISION=${{ fromJSON(steps.meta-w.outputs.json).labels['org.opencontainers.image.revision'] }}
--squash # Enable image squashing to produce a single-layer image
load: false
push: ${{ github.event_name != 'pull_request' }}
secrets: |
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/deploy-DEV-linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ jobs:
BUILD_DATE=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
BUILD_VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
BUILD_REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
--squash # Enable image squashing to produce a single-layer image
load: true
push: false
secrets: |
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/deploy-DEV.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ jobs:
BUILD_VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
BUILD_REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
MEGA_LINTER_BASE_IMAGE="oxsecurity/megalinter:beta"
--squash # Enable image squashing to produce a single-layer image
load: true
push: false
secrets: |
Expand Down Expand Up @@ -120,6 +121,7 @@ jobs:
BUILD_DATE=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
BUILD_VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
BUILD_REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
--squash # Enable image squashing to produce a single-layer image
load: true
push: false
secrets: |
Expand Down Expand Up @@ -147,6 +149,7 @@ jobs:
BUILD_DATE=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
BUILD_VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
BUILD_REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
--squash # Enable image squashing to produce a single-layer image
load: true
push: false
secrets: |
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/deploy-RELEASE-flavors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ jobs:
BUILD_DATE=${{ env.BUILD_DATE }}
BUILD_REVISION=${{ github.sha }}
BUILD_VERSION=${{ github.event.release.tag_name }}
--squash # Enable image squashing to produce a single-layer image
load: false
push: true
secrets: |
Expand Down Expand Up @@ -134,6 +135,7 @@ jobs:
BUILD_DATE=${{ env.BUILD_DATE }}
BUILD_REVISION=${{ github.sha }}
BUILD_VERSION=${{ github.event.release.tag_name }}
--squash # Enable image squashing to produce a single-layer image
load: false
push: true
secrets: |
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/deploy-RELEASE-linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ jobs:
BUILD_DATE=${{ env.BUILD_DATE }}
BUILD_REVISION=${{ github.sha }}
BUILD_VERSION=${{ github.event.release.tag_name }}
--squash # Enable image squashing to produce a single-layer image
load: false
push: true
secrets: |
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/deploy-RELEASE.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ jobs:
BUILD_DATE=${{ env.BUILD_DATE }}
BUILD_REVISION=${{ github.sha }}
BUILD_VERSION=${{ github.event.release.tag_name }}
--squash # Enable image squashing to produce a single-layer image
load: false
push: true
secrets: |
Expand Down Expand Up @@ -130,6 +131,7 @@ jobs:
BUILD_DATE=${{ env.BUILD_DATE }}
BUILD_REVISION=${{ github.sha }}
BUILD_VERSION=${{ github.event.release.tag_name }}
--squash # Enable image squashing to produce a single-layer image
load: false
push: true
secrets: |
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Note: Can be used with `oxsecurity/megalinter@beta` in your GitHub Action mega-l
- CI
- Also prune volumes before pulling and pushing to docker hub
- Externalize mirroring from ghcr.io to docker hub in another workflow to avoid memory issues
- Squash docker images to have less layers and size

- mega-linter-runner

Expand Down

0 comments on commit e13ac87

Please sign in to comment.