Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: use custom action for docker slim #3301

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
kyubisation marked this conversation as resolved.
Show resolved Hide resolved
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 @@ -96,20 +96,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 @@ -125,12 +121,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
Loading