diff --git a/.github/actions/docker-slim/action.yml b/.github/actions/docker-slim/action.yml new file mode 100644 index 0000000000..3f4550f49b --- /dev/null +++ b/.github/actions/docker-slim/action.yml @@ -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 diff --git a/.github/workflows/continuous-integration-secure.yml b/.github/workflows/continuous-integration-secure.yml index e4d1815ae3..f8dfe17655 100644 --- a/.github/workflows/continuous-integration-secure.yml +++ b/.github/workflows/continuous-integration-secure.yml @@ -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 @@ -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 diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index ee60ae9c38..873805cd88 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -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 diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index c3cc0f0568..4f71ff69d0 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -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: | @@ -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