Update docker-image.yml
This commit is contained in:
1 parent
6f407ce163
commit
ab53bd898e
1 file changed
+67
-61
@@ -1,64 +1,70 @@
|
|||||||
# Этот рабочий процесс использует действия, которые не сертифицированы GitHub.
|
|
||||||
# Они предоставляются сторонним поставщиком, и на них распространяются
|
|
||||||
# отдельные условия обслуживания, политика конфиденциальности и поддержка
|
|
||||||
# документации.
|
|
||||||
|
|
||||||
# GitHub рекомендует закрепить действия в фиксации SHA.
|
|
||||||
# Чтобы получить более новую версию, потребуется обновить SHA.
|
|
||||||
# Вы также можете ссылаться на тег или ветвь, однако действие может измениться без предупреждения.
|
|
||||||
|
|
||||||
name: Publish Docker image
|
|
||||||
|
|
||||||
on:
|
|
||||||
release:
|
|
||||||
types: [published]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
push_to_registries:
|
|
||||||
name: Push Docker image to multiple registries
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
packages: write
|
|
||||||
contents: read
|
|
||||||
attestations: write
|
|
||||||
id-token: write
|
|
||||||
steps:
|
|
||||||
- name: Check out the repo
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Log in to Docker Hub
|
|
||||||
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
|
|
||||||
- name: Log in to the Container registry
|
|
||||||
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Extract metadata (tags, labels) for Docker
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
|
|
||||||
with:
|
|
||||||
images: |
|
|
||||||
my-docker-hub-namespace/my-docker-hub-repository
|
|
||||||
ghcr.io/${{ github.repository }}
|
|
||||||
|
|
||||||
- name: Build and push Docker images
|
- name: Build and push Docker images
|
||||||
id: push
|
# You may pin to the exact commit or the version.
|
||||||
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
|
# uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75
|
||||||
|
uses: docker/build-push-action@v6.9.0
|
||||||
with:
|
with:
|
||||||
context: .
|
# List of a customs host-to-IP mapping (e.g., docker:10.180.0.1)
|
||||||
push: true
|
add-hosts: # optional
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
# List of extra privileged entitlement (e.g., network.host,security.insecure)
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
allow: # optional
|
||||||
|
# List of annotation to set to the image
|
||||||
|
annotations: # optional
|
||||||
|
# List of attestation parameters (e.g., type=sbom,generator=image)
|
||||||
|
attests: # optional
|
||||||
|
# List of build-time variables
|
||||||
|
build-args: # optional
|
||||||
|
# List of additional build contexts (e.g., name=path)
|
||||||
|
build-contexts: # optional
|
||||||
|
# Builder instance
|
||||||
|
builder: # optional
|
||||||
|
# List of external cache sources for buildx (e.g., user/app:cache, type=local,src=path/to/dir)
|
||||||
|
cache-from: # optional
|
||||||
|
# List of cache export destinations for buildx (e.g., user/app:cache, type=local,dest=path/to/dir)
|
||||||
|
cache-to: # optional
|
||||||
|
# Optional parent cgroup for the container used in the build
|
||||||
|
cgroup-parent: # optional
|
||||||
|
# Build's context is the set of files located in the specified PATH or URL
|
||||||
|
context: # optional
|
||||||
|
# Path to the Dockerfile
|
||||||
|
file: # optional
|
||||||
|
# List of metadata for an image
|
||||||
|
labels: # optional
|
||||||
|
# Load is a shorthand for --output=type=docker
|
||||||
|
load: # optional, default is false
|
||||||
|
# Set the networking mode for the RUN instructions during build
|
||||||
|
network: # optional
|
||||||
|
# Do not use cache when building the image
|
||||||
|
no-cache: # optional, default is false
|
||||||
|
# Do not cache specified stages
|
||||||
|
no-cache-filters: # optional
|
||||||
|
# List of output destinations (format: type=local,dest=path)
|
||||||
|
outputs: # optional
|
||||||
|
# List of target platforms for build
|
||||||
|
platforms: # optional
|
||||||
|
# Generate provenance attestation for the build (shorthand for --attest=type=provenance)
|
||||||
|
provenance: # optional
|
||||||
|
# Always attempt to pull all referenced images
|
||||||
|
pull: # optional, default is false
|
||||||
|
# Push is a shorthand for --output=type=registry
|
||||||
|
push: # optional, default is false
|
||||||
|
# Generate SBOM attestation for the build (shorthand for --attest=type=sbom)
|
||||||
|
sbom: # optional
|
||||||
|
# List of secrets to expose to the build (e.g., key=string, GIT_AUTH_TOKEN=mytoken)
|
||||||
|
secrets: # optional
|
||||||
|
# List of secret env vars to expose to the build (e.g., key=envname, MY_SECRET=MY_ENV_VAR)
|
||||||
|
secret-envs: # optional
|
||||||
|
# List of secret files to expose to the build (e.g., key=filename, MY_SECRET=./secret.txt)
|
||||||
|
secret-files: # optional
|
||||||
|
# Size of /dev/shm (e.g., 2g)
|
||||||
|
shm-size: # optional
|
||||||
|
# List of SSH agent socket or keys to expose to the build
|
||||||
|
ssh: # optional
|
||||||
|
# List of tags
|
||||||
|
tags: # optional
|
||||||
|
# Sets the target stage to build
|
||||||
|
target: # optional
|
||||||
|
# Ulimit options (e.g., nofile=1024:1024)
|
||||||
|
ulimit: # optional
|
||||||
|
# GitHub Token used to authenticate against a repository for Git context
|
||||||
|
github-token: # optional, default is ${{ github.token }}
|
||||||
|
|
||||||
- name: Generate artifact attestation
|
|
||||||
uses: actions/attest-build-provenance@v1
|
|
||||||
with:
|
|
||||||
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
|
|
||||||
subject-digest: ${{ steps.push.outputs.digest }}
|
|
||||||
push-to-registry: true
|
|
||||||
Reference in new issue
Block a user