Skip to content

Commit

Permalink
build: use mint to minify container images
Browse files Browse the repository at this point in the history
  • Loading branch information
kyubisation authored Jan 30, 2025
1 parent dcedae0 commit 646e3d0
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
19 changes: 19 additions & 0 deletions .github/actions/setup-mint/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: mint
description: Setup https://github.com/mintoolkit/mint

runs:
using: composite
steps:
- name: Setup mint
run: |
mkdir -p "$HOME/.local/bin"
cd "$HOME/.local/bin"
# Get the current released tag_name
VER=$(curl -sL https://api.github.com/repos/mintoolkit/mint/releases \
| grep tag_name | head -n1 | cut -d'"' -f4)
curl -L -o mint.tar.gz "https://github.com/mintoolkit/mint/releases/download/${VER}/dist_linux.tar.gz"
tar -xvf mint.tar.gz --strip-components 1
echo "Installed mint:${VER}"
shell: bash
16 changes: 10 additions & 6 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,15 @@ jobs:
with:
name: showcase
path: dist/
- name: 'Container: Login to GitHub Container Repository'
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io --username ${{ github.actor }} --password-stdin
- name: 'Container: Build image'
run: docker build -t $IMAGE_REPO:latest .
- uses: ./.github/actions/setup-mint
- name: 'Container: Build and push image'
run: |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io --username ${{ github.actor }} --password-stdin
docker build -t $IMAGE_REPO:latest-fat .
mint slim \
--target $IMAGE_REPO:latest-fat \
--tag $IMAGE_REPO:latest \
--preserve-path /usr/share/nginx/html
docker push $IMAGE_REPO:latest
env:
DOCKER_BUILDKIT: 1
- name: 'Container: Publish image'
run: docker push $IMAGE_REPO:latest

0 comments on commit 646e3d0

Please sign in to comment.