Skip to content

Adding GitHub workflows to generate container images (#235) #1

Adding GitHub workflows to generate container images (#235)

Adding GitHub workflows to generate container images (#235) #1

---
name: Container Build Merge
on:
push:
branches:
- 'main'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout Repository 🛎️
uses: actions/checkout@v4
- name: Set up Docker Buildx 🐳
uses: docker/setup-buildx-action@v3
- name: Login to Container Registry 🪪
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for container 📤
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Use Node 20.x 🔧
uses: actions/setup-node@v4
with:
node-version: "20.x"
cache: "npm"
- name: Install App Build Dependencies 📃
run: |
npm ci
- name: Build App 🛠️
run: |
npm run build
- name: Build and push container 🚢
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}