Build Node.js #44
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: Build Node.js | |
on: | |
workflow_dispatch: | |
inputs: | |
image_name: | |
description: Docker image name | |
required: true | |
default: nodejs | |
image_version: | |
description: Docker image version | |
required: true | |
default: 18 | |
type: choice | |
options: | |
- 20 | |
- 18 | |
- 16 | |
- 14 | |
- 12 | |
- 10 | |
- 8 | |
image_variant: | |
description: Docker image variant | |
required: true | |
default: all | |
type: choice | |
options: | |
- all | |
- alpine | |
- alpine-glibc | |
- alpine-oci | |
- debian | |
- debian-oci | |
jobs: | |
build_specific: | |
if: ${{ inputs.image_variant != 'all' }} | |
name: "Build and push to registry ${{ inputs.image_name }}:${{ inputs.image_version }}-${{ inputs.image_variant }}" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: "Build and push to registry ${{ inputs.image_name }}:${{ inputs.image_version }}-${{ inputs.image_variant }}" | |
uses: docker/build-push-action@v3 | |
with: | |
context: ${{ inputs.image_name }} | |
file: ${{ inputs.image_name }}/Dockerfile-${{ inputs.image_version }}_${{ inputs.image_variant }} | |
push: true | |
tags: ${{ secrets.DOCKER_USERNAME }}/${{ inputs.image_name }}:${{ inputs.image_version }}-${{ inputs.image_variant }} | |
build_nodejs_alpine: | |
if: ${{ inputs.image_variant == 'all' }} | |
name: "Build and push to registry ${{ inputs.image_name }}:${{ inputs.image_version }}-alpine" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: "Build and push to registry ${{ inputs.image_name }}:${{ inputs.image_version }}-alpine" | |
uses: docker/build-push-action@v3 | |
with: | |
context: ${{ inputs.image_name }} | |
file: ${{ inputs.image_name }}/Dockerfile-${{ inputs.image_version }}_alpine | |
push: true | |
tags: ${{ secrets.DOCKER_USERNAME }}/${{ inputs.image_name }}:${{ inputs.image_version }}-alpine | |
build_nodejs_alpine_glibc: | |
if: ${{ inputs.image_variant == 'all' }} | |
name: "Build and push to registry ${{ inputs.image_name }}:${{ inputs.image_version }}-alpine-glibc" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: "Build and push to registry ${{ inputs.image_name }}:${{ inputs.image_version }}-alpine-glibc" | |
uses: docker/build-push-action@v3 | |
with: | |
context: ${{ inputs.image_name }} | |
file: ${{ inputs.image_name }}/Dockerfile-${{ inputs.image_version }}_alpine-glibc | |
push: true | |
tags: ${{ secrets.DOCKER_USERNAME }}/${{ inputs.image_name }}:${{ inputs.image_version }}-alpine-glibc | |
build_nodejs_alpine_oci: | |
if: ${{ inputs.image_variant == 'all' }} | |
name: "Build and push to registry ${{ inputs.image_name }}:${{ inputs.image_version }}-alpine-oci" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: "Build and push to registry ${{ inputs.image_name }}:${{ inputs.image_version }}-alpine-oci" | |
uses: docker/build-push-action@v3 | |
with: | |
context: ${{ inputs.image_name }} | |
file: ${{ inputs.image_name }}/Dockerfile-${{ inputs.image_version }}_alpine-oci | |
push: true | |
tags: ${{ secrets.DOCKER_USERNAME }}/${{ inputs.image_name }}:${{ inputs.image_version }}-alpine-oci | |
build_nodejs_debian: | |
if: ${{ inputs.image_variant == 'all' }} | |
name: "Build and push to registry ${{ inputs.image_name }}:${{ inputs.image_version }}-debian" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: "Build and push to registry ${{ inputs.image_name }}:${{ inputs.image_version }}-debian" | |
uses: docker/build-push-action@v3 | |
with: | |
context: ${{ inputs.image_name }} | |
file: ${{ inputs.image_name }}/Dockerfile-${{ inputs.image_version }}_debian | |
push: true | |
tags: ${{ secrets.DOCKER_USERNAME }}/${{ inputs.image_name }}:${{ inputs.image_version }}-debian | |
build_nodejs_debian_oci: | |
if: ${{ inputs.image_variant == 'all' }} | |
name: "Build and push to registry ${{ inputs.image_name }}:${{ inputs.image_version }}-debian-oci" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: "Build and push to registry ${{ inputs.image_name }}:${{ inputs.image_version }}-debian-oci" | |
uses: docker/build-push-action@v3 | |
with: | |
context: ${{ inputs.image_name }} | |
file: ${{ inputs.image_name }}/Dockerfile-${{ inputs.image_version }}_debian-oci | |
push: true | |
tags: ${{ secrets.DOCKER_USERNAME }}/${{ inputs.image_name }}:${{ inputs.image_version }}-debian-oci | |