Skip to content

Update dependencies #15

Update dependencies

Update dependencies #15

Workflow file for this run

name: Docker
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
on:
# schedule:
# - cron: '25 19 * * *'
# push:
# branches: [ "main" ]
# # Publish semver tags as releases.
# tags: [ 'v*.*.*' ]
push:
branches: ['kenmuse/vNext']
pull_request:
branches: ['kenmuse/vNext']
workflow_dispatch:
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}-server
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
# Install the cosign tool except on PR
# https://github.com/sigstore/cosign-installer
- name: Install cosign
if: ${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' }}
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 #v3.5.0
with:
cosign-release: 'v2.2.4'
- name: Set up QEMU
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf #v3.2.0
- name: Extract versions
run: |
NODE_VERSION=$(cat .devcontainer/devcontainer.json | sed 's/^ *\/\/.*//' | jq -r '.features."ghcr.io/devcontainers/features/node:1".version' )
NODE_MAJOR=$(cat .devcontainer/devcontainer.json | sed 's/^ *\/\/.*//' | jq -r '.features."ghcr.io/devcontainers/features/node:1".version | split(".") | map(tonumber) | .[0]')
PACKAGE_VERSION=$(cat package.json | jq -r '.version')
echo "NODE_VERSION=${NODE_VERSION}" >> $GITHUB_ENV
echo "NODE_MAJOR=${NODE_MAJOR}" >> $GITHUB_ENV
echo "PACKAGE_VERSION=${PACKAGE_VERSION}" >> $GITHUB_ENV
echo "SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)" >> $GITHUB_ENV
# Set up BuildKit Docker container builder to be able to build
# multi-platform images and export cache
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: ${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' }}
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=${{ env.PACKAGE_VERSION}}-node${{ env.NODE_MAJOR }}
env:
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@5cd11c3a4ced054e52742c5fd54dca954e0edd85 # v6.7.0
with:
context: .
sbom: true
build-args: |
NODE_VERSION=${{ env.NODE_VERSION }}
provenance: mode=max
platforms: linux/amd64,linux/arm64
annotations: ${{ steps.meta.outputs.annotations }}
file: '${{ github.workspace }}/packages/server/Dockerfile'
push: ${{ github.ref == 'refs/heads/main' && 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
# Sign the resulting Docker image digest except on PRs.
# This will only write to the public Rekor transparency log when the Docker
# repository is public to avoid leaking data. If you would like to publish
# transparency data even for private images, pass --force to cosign below.
# https://github.com/sigstore/cosign
- name: Sign the published Docker image
if: ${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' }}
env:
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
TAGS: ${{ steps.meta.outputs.tags }}
DIGEST: ${{ steps.build-and-push.outputs.digest }}
# This step uses the identity token to provision an ephemeral certificate
# against the sigstore community Fulcio instance.
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}