From 4f245e50cc423caf24adb8d61375942f3559ff86 Mon Sep 17 00:00:00 2001 From: Arham Jain Date: Wed, 23 Oct 2024 14:21:20 +0530 Subject: [PATCH] ci(workflow): using the alpine --- .github/workflows/docker.yml | 16 ++++++++++++---- Dockerfile | 7 ++----- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index e0be971..9cd4b16 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -32,11 +32,19 @@ jobs: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Declare version variables - shell: bash + - name: Get short commit hash and determine branch name + id: set-env-vars run: | - echo "SHORT_COMMIT_HASH=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV" - echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> "$GITHUB_ENV" + # Get short commit hash + echo "Branch: $(git rev-parse --short HEAD)" + echo "SHORT_COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV + + # Determine branch name + if [ "${{ github.event_name }}" == "pull_request" ]; then + echo "BRANCH_NAME=${{ github.head_ref }}" >> $GITHUB_ENV # Source branch of the PR + else + echo "BRANCH_NAME=${{ github.ref_name }}" >> $GITHUB_ENV # Actual branch name for push events + fi - name: Echo step run: | echo "Branch: ${{ env.SHORT_COMMIT_HASH }}" diff --git a/Dockerfile b/Dockerfile index 5ada99c..28c99a8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,7 @@ # syntax=docker/dockerfile:1 -## global args -ARG NODE_VERSION=18.16.1 - -FROM node:${NODE_VERSION} -SHELL [ "/bin/bash", "-cex" ] +FROM node:18.16.1-alpine +SHELL [ "/bin/sh", "-cex" ] # Create app directory WORKDIR /usr/src/app