Infra: Build container image for all branches (#5)

* infra: Build images for all branches without the need of tags. Stop using latest tag on container image.

* Fix npm install on docker
There are errors when the branch is not ready to be merged. This is a temporary fix to make the docker image buildable on all branches.
This commit is contained in:
Enrique Calderon 2025-02-07 09:58:35 -06:00 committed by GitHub
parent fddd0582e8
commit 40ca7d4b6e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 7 deletions

View File

@ -2,8 +2,8 @@ name: Docker Build and Push
on: on:
push: push:
tags: branches:
- "*" - '**'
concurrency: concurrency:
group: "docker-image" group: "docker-image"
@ -27,12 +27,15 @@ jobs:
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.actor }} username: ${{ github.actor }}
password: ${{ secrets.GH_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- name: Downcase REPO variable
run: |
echo "REPO=${GITHUB_REPOSITORY@L}" >> "${GITHUB_ENV}"
- name: Build and push - name: Build and push
uses: docker/build-push-action@v5 uses: docker/build-push-action@v5
with: with:
push: true push: true
tags: ghcr.io/${{ github.repository }}:latest,ghcr.io/${{ github.repository }}:${{ github.ref_name }} tags: ghcr.io/${{ env.REPO }}:${{ github.ref_name }}, ghcr.io/${{ env.REPO }}:${{ github.sha }}
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64

View File

@ -2,7 +2,8 @@
FROM node:20-alpine AS build FROM node:20-alpine AS build
WORKDIR /app WORKDIR /app
COPY package*.json ./ COPY package*.json ./
RUN npm ci RUN npm install && \
npm ci
COPY . . COPY . .
RUN npm run build RUN npm run build