Skip to content

feat: publish slim package #7

feat: publish slim package

feat: publish slim package #7

name: Publish Docker Image to GHCR
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Log in to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and tag Docker image
run: |
docker build -t ghcr.io/${{ github.repository }}:latest .
- name: Install Slim Toolkit
run: |
wget https://github.com/slimtoolkit/slim/releases/download/1.40.11/dist_linux.tar.gz
tar -xzf dist_linux.tar.gz
sudo cp dist_linux/docker-slim /usr/local/bin/
- name: Slim Docker image
run: |
docker-slim build --tag ghcr.io/${{ github.repository }}:slim ghcr.io/${{ github.repository }}:latest --http-probe=true --continue-after=30
- name: Push Docker image to GHCR
run: |
docker push ghcr.io/${{ github.repository }}:latest
docker push ghcr.io/${{ github.repository }}:slim