Skip to content

fixed: optimization in the Dockerfile #7

fixed: optimization in the Dockerfile

fixed: optimization in the Dockerfile #7

Workflow file for this run

name: Build and push image📦
on:
workflow_dispatch:
# schedule:
# - cron: "00 17 * * SAT"
push:
branches: ["http3"]
# pull_request:
# branches: ["http3"]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
if: github.actor == 'ammnt'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Checkout repository
uses: actions/[email protected]
- name: Install cosign
if: github.event_name != 'pull_request'
uses: sigstore/[email protected]
- name: Setup Docker buildx
uses: docker/[email protected]
- name: Log into ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Log into Docker Hub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/[email protected]
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build the Docker image
id: build
uses: docker/[email protected]
with:
provenance: false
context: .
platforms: linux/amd64
load: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Slim the Docker image
uses: kitabisa/[email protected]
env:
DSLIM_HTTP_PROBE: false
with:
target: ghcr.io/ammnt/freenginx:http3
tag: ghcr.io/ammnt/freenginx:http3
overwrite: true
- name: Test the Docker image
run: |
docker run -d --rm -p 127.0.0.1:8080:8080/tcp ghcr.io/ammnt/freenginx:http3
curl -v http://127.0.0.1:8080 || exit 1
- name: Scan the Docker image
uses: anchore/[email protected]
with:
image: ghcr.io/ammnt/freenginx:http3
- name: Push the Docker images to ghcr.io
run: docker push ghcr.io/ammnt/freenginx:http3
- name: Push the Docker images to docker.io
run: |
docker tag ghcr.io/ammnt/freenginx:http3 ammnt/freenginx:http3
docker push ammnt/freenginx:http3
- name: Sign the published Docker image
if: ${{ github.event_name != 'pull_request' }}
env:
COSIGN_EXPERIMENTAL: "true"
run: |
cosign sign ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.build.outputs.digest }}
cosign sign docker.io/${{ env.IMAGE_NAME }}@${{ steps.build.outputs.digest }}