docs: Update readme #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create and publish a Docker image | |
on: | |
push: | |
branches: ['main'] | |
env: | |
REGISTRY: ghcr.io | |
REPO_NAME: ${{ github.repository }} | |
DOCKER_SLIM_VERSION: 1.37.3 | |
jobs: | |
build-and-push-image: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Set docker image env var | |
run: | | |
echo "IMAGE_NAME=${{ env.REGISTRY }}/${{ env.REPO_NAME }}:${{ env.DOCKER_SLIM_VERSION }}" >> $GITHUB_ENV | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_TOKEN }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
build-args: | | |
"DOCKER_SLIM_VERSION=${{ env.DOCKER_SLIM_VERSION }}" | |
push: true | |
tags: ${{ env.IMAGE_NAME }} | |
- name: Make a Slim image | |
uses: kitabisa/docker-slim-action@v1 | |
env: | |
DSLIM_HTTP_PROBE: false | |
with: | |
target: ${{ env.IMAGE_NAME }} | |
tag: "${{ env.DOCKER_SLIM_VERSION }}-slim" | |
# Push to the registry | |
- run: docker push ${{ env.IMAGE_NAME }}-slim |