Nodejs Image #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Nodejs Image | |
on: | |
workflow_dispatch: | |
env: | |
DOCKER_REGISTRY: ghcr.io | |
IMAGE_NAME: ayaka-notes/image-cn/node | |
jobs: | |
clean-node-texlive: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Delete 'untaged' containers | |
uses: snok/container-retention-policy@v2 | |
with: | |
image-names: node/*,node | |
cut-off: 1 min ago UTC | |
account-type: org | |
org-name: ayaka-notes | |
untagged-only: true | |
token: ${{ secrets.ORGTOKEN }} | |
build-image: | |
runs-on: ubuntu-latest | |
needs: clean-node-texlive | |
strategy: | |
fail-fast: false | |
max-parallel: 3 | |
matrix: | |
node-version: [18.18.2, 16.13.0] | |
name: Nodejs ${{ matrix.node-version }} | |
steps: | |
- name: "Checkout GitHub Action" | |
id: checkout | |
uses: actions/checkout@main | |
- name: "Login to GitHub Container Registry" | |
id: docker_login | |
uses: docker/[email protected] | |
with: | |
registry: ${{env.DOCKER_REGISTRY}} | |
username: ${{github.actor}} | |
password: ${{secrets.GITHUB_TOKEN}} | |
- name: Build and push Docker image | |
uses: docker/[email protected] | |
with: | |
context: ./node | |
file: ./node/Dockerfile | |
push: true | |
tags: ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.node-version }} | |
# 参数 | |
build-args: | | |
nodetag=${{ matrix.node-version }} |