Skip to content

fix: added the Add CI matrix for Multiple version of node with tag #4 #16

fix: added the Add CI matrix for Multiple version of node with tag #4

fix: added the Add CI matrix for Multiple version of node with tag #4 #16

Workflow file for this run

name: Build and Push
on:
push:
env:
NODE_VERSION: "20.10.0"
ALPINE_VERSION: "3.18"
jobs:
build:
name: Build and Push Image
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18, 20] # List of Node.js versions to test
steps:
- name: Checkout code
uses: actions/checkout@v4
timeout-minutes: 5
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
timeout-minutes: 5
- name: Create Tag
id: tag
run: echo "tag=${{ matrix.node-version }}-$(git rev-parse --short HEAD)-$(date +%s)" >> $GITHUB_OUTPUT
timeout-minutes: 5
- name: Login to Docker Hub
if: ${{ github.ref_name == 'main' }}
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
timeout-minutes: 5
- name: Build and Push Docker Image
uses: docker/build-push-action@v5
with:
build-args: |
NODE_VERSION=${{ matrix.node-version }}
ALPINE_VERSION=${{ env.ALPINE_VERSION }}
context: .
push: ${{ github.ref_name == 'main' }}
tags: "improwised/docker-nodejs-base:${{ steps.tag.outputs.tag }}"
timeout-minutes: 10