Skip to content

project setup

project setup #7

Workflow file for this run

name: Publish Docker Image
on:
push:
branches: [ main ]
schedule:
- cron: '0 0 1 * *' # At 00:00 on day-of-month 1.
workflow_dispatch:
env:
DOCKER_CLI_EXPERIMENTAL: enabled
jobs:
publish:
runs-on: ubuntu-latest
timeout-minutes: 120
strategy:
matrix:
version: [16, 18, 20, lts]
permissions:
packages: write
contents: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: 'main'
fetch-depth: 0
- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ github.repository_owner }}/node
# ghcr.io/${{ github.repository_owner }}/node
# public.ecr.aws/${{ github.repository_owner }}/node
labels: |
org.opencontainers.image.authors=${{ github.repository_owner }}
tags: |
type=raw,value=${{ matrix.version }}-alpine
flavor: |
latest=false
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
with:
install: true
driver-opts: image=moby/buildkit:master
- name: Login to DockerHub
id: login-dockerhub
uses: docker/login-action@v3
with:
logout: false
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# - name: Login to GitHub Container Registry
# uses: docker/login-action@v3
# with:
# registry: ghcr.io
# # username: ${{ github.repository_owner }}
# username: ${{ github.actor }}
# password: ${{ github.token }}
# - name: Login to Public ECR
# uses: docker/login-action@v3
# with:
# registry: public.ecr.aws
# username: ${{ secrets.AWS_ECR_ACCESS_KEY_ID }}
# password: ${{ secrets.AWS_ECR_SECRET_ACCESS_KEY }}
# env:
# AWS_REGION: us-east-1
- name: Build and push Docker images
id: build-and-push
uses: docker/build-push-action@v5
continue-on-error: true
with:
push: ${{ github.event_name != 'pull_request' }}
context: .
platforms: linux/amd64,linux/arm64/v8,linux/arm/v7,linux/arm/v6,linux/ppc64le,linux/s390x
build-args: NODE_VERSION=${{ matrix.version }}
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max