Skip to content

Commit

Permalink
build: use custom action for docker slim (#3301)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyubisation committed Dec 16, 2024
1 parent 5fc0634 commit 7aeae53
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 18 deletions.
24 changes: 24 additions & 0 deletions .github/actions/docker-slim/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Docker Slim
description: Create slim versions of an existing container images

inputs:
target:
description: The target image
required: true
tag:
description: The new tag
required: true
runs:
using: composite
steps:
- name: Setup docker slim
run: |
mkdir /tmp/ds
cd /tmp/ds
curl -L -o ds.tar.gz https://github.com/slimtoolkit/slim/releases/download/1.40.11/dist_linux.tar.gz
tar -xvf ds.tar.gz --strip-components 1
echo "/tmp/ds" >> $GITHUB_PATH
shell: bash
- name: Run docker slim
run: slim build --target ${{ inputs.target }} --tag ${{ inputs.tag }} --preserve-path /usr/share/nginx/html
shell: bash
8 changes: 2 additions & 6 deletions .github/workflows/continuous-integration-secure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,10 @@ jobs:
env:
DOCKER_BUILDKIT: 1
- name: Build slim image
uses: kitabisa/docker-slim-action@v1
uses: ./.github/actions/docker-slim
with:
target: '${{ env.IMAGE_REPO_PREVIEW }}:pr${{ env.PR_NUMBER }}'
tag: 'pr${{ env.PR_NUMBER }}-slim'
env:
DSLIM_PRESERVE_PATH: /usr/share/nginx/html
- name: Push slim image
run: |
docker push $IMAGE_REPO_PREVIEW:pr$PR_NUMBER-slim
Expand Down Expand Up @@ -193,12 +191,10 @@ jobs:
env:
DOCKER_BUILDKIT: 1
- name: Build slim image
uses: kitabisa/docker-slim-action@v1
uses: ./.github/actions/docker-slim
with:
target: '${{ env.IMAGE_REPO_VISUAL_REGRESSION }}:pr${{ env.PR_NUMBER }}'
tag: 'pr${{ env.PR_NUMBER }}-slim'
env:
DSLIM_PRESERVE_PATH: /usr/share/nginx/html
- name: Push slim image
run: |
docker push $IMAGE_REPO_VISUAL_REGRESSION:pr$PR_NUMBER-slim
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,10 @@ jobs:
env:
DOCKER_BUILDKIT: 1
- name: Build slim image
uses: kitabisa/docker-slim-action@v1
uses: ./.github/actions/docker-slim
with:
target: '${{ env.IMAGE_REPO_VISUAL_REGRESSION }}:baseline'
tag: baseline-slim
env:
DSLIM_PRESERVE_PATH: /usr/share/nginx/html
- name: Push slim image
run: |
docker push $IMAGE_REPO_VISUAL_REGRESSION:baseline-slim
Expand Down
12 changes: 3 additions & 9 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,20 +97,16 @@ jobs:
VERSION: ${{ steps.release.outputs.version }}
- name: Build slim image with version
if: ${{ steps.release.outputs.release_created }}
uses: kitabisa/docker-slim-action@v1
uses: ./.github/actions/docker-slim
with:
target: '${{ env.IMAGE_REPO_STORYBOOK }}:${{ steps.release.outputs.version }}'
tag: '${{ steps.release.outputs.version }}-slim'
env:
DSLIM_PRESERVE_PATH: /usr/share/nginx/html
- name: Build slim image with latest
if: ${{ steps.release.outputs.release_created }}
uses: kitabisa/docker-slim-action@v1
uses: ./.github/actions/docker-slim
with:
target: '${{ env.IMAGE_REPO_STORYBOOK }}:latest'
tag: latest-slim
env:
DSLIM_PRESERVE_PATH: /usr/share/nginx/html
- name: Push slim image
if: ${{ steps.release.outputs.release_created }}
run: |
Expand All @@ -126,12 +122,10 @@ jobs:
env:
DOCKER_BUILDKIT: 1
- name: Build slim image with dev
uses: kitabisa/docker-slim-action@v1
uses: ./.github/actions/docker-slim
with:
target: '${{ env.IMAGE_REPO_STORYBOOK }}:dev'
tag: dev-slim
env:
DSLIM_PRESERVE_PATH: /usr/share/nginx/html
- name: Push slim image
run: |
docker push $IMAGE_REPO_STORYBOOK:dev-slim
Expand Down

0 comments on commit 7aeae53

Please sign in to comment.