-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (35 loc) · 1.21 KB
/
docker-publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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