Skip to content

Commit

Permalink
GitHub workflow to build frontend image (#1)
Browse files Browse the repository at this point in the history
Added a workflow to trigger docker image build and push to Github container registry for frontend. Added frontend envs to dockerfile.
  • Loading branch information
SanttuA authored Oct 11, 2024
1 parent 0e738c1 commit 0228d14
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/publish-front-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Publish Frontend Image to GHCR

on:
workflow_dispatch:
inputs:
tag:
description: 'Image tag'
required: true
default: 'latest'

env:
IMAGE_NAME: frontend

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=${{ github.event.inputs.tag }}
type=sha,prefix={{date 'YYYYMMDD'}}-
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: ./frontend
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
10 changes: 10 additions & 0 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ RUN npm cache clean --force && npm ci

# Build the application
COPY . .

ARG NEXT_PUBLIC_CHAT_API=http://localhost:8000/api/chat
ENV NEXT_PUBLIC_CHAT_API=$NEXT_PUBLIC_API_URL

ARG NEXT_PUBLIC_USE_LLAMACLOUD=false
ENV NEXT_PUBLIC_USE_LLAMACLOUD=$NEXT_PUBLIC_USE_LLAMACLOUD

ARG NEXT_TELEMETRY_DISABLED=1
ENV NEXT_TELEMETRY_DISABLED=$NEXT_TELEMETRY_DISABLED

RUN npm run build

# Production stage
Expand Down

0 comments on commit 0228d14

Please sign in to comment.