Skip to content

Push Alpine Dev Image #273

Push Alpine Dev Image

Push Alpine Dev Image #273

name: Push Alpine Dev Image
on:
push:
branches:
- '0.2.2'
permissions:
contents: read
packages: write
id-token: write
security-events: write
jobs:
push_dev_image:
name: Build and Push Dev Image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: docker/setup-qemu-action@v3
with:
platforms: linux/amd64,linux/arm64
- uses: docker/setup-buildx-action@v3
with:
install: true
driver-opts: |
image=moby/buildkit:v0.12.5
- name: Install Cosign
run: |
curl -Lo cosign https://github.com/sigstore/cosign/releases/latest/download/cosign-linux-amd64
chmod +x cosign
sudo mv cosign /usr/local/bin/cosign
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: docker/metadata-action@v5
id: meta
with:
images: orenlab/pytmbot
tags: |
type=raw,value=alpine-dev
labels: |
org.opencontainers.image.title=pyTMbot
org.opencontainers.image.description=Telegram bot for Docker monitoring
org.opencontainers.image.source=https://github.com/orenlab/pytmbot
- uses: docker/build-push-action@v5
id: build-and-push
with:
context: .
target: production
file: Dockerfile
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
provenance: mode=max
sbom: true
- name: Sign image and generate attestation
env:
COSIGN_EXPERIMENTAL: 1
run: |
IMAGE_REF="orenlab/pytmbot:alpine-dev"
cosign sign --yes $IMAGE_REF
echo "Generating attestation..."
cat <<EOF > provenance.att
{
"buildType": "docker",
"buildConfig": {
"context": ".",
"dockerfile": "Dockerfile"
}
}
EOF
cosign attest --yes --predicate provenance.att --type custom $IMAGE_REF
- uses: anchore/scan-action@v3
with:
image: orenlab/pytmbot:alpine-dev
fail-build: false
severity-cutoff: high
- uses: actions/upload-artifact@v4
with:
name: security-artifacts
path: |
provenance.att
retention-days: 5