Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,16 @@ jobs:
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
type=ref,event=branch
type=sha

# 3. Build and push Docker image
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
context: ./backend
push: ${{ github.event_name != 'pull_request' }} # Only push on merge to main
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Expand Down Expand Up @@ -73,5 +77,5 @@ jobs:
script: |
cd ~/my-app
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
docker compose pull
docker compose up -d
docker-compose pull
docker-compose up -d
6 changes: 4 additions & 2 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
docker
# --- STAGE 1: Build ---
FROM node:20-alpine AS builder
WORKDIR /app
Expand All @@ -19,11 +20,12 @@ ENV NODE_ENV=production

# Copy ONLY the production dependencies (ignores devDependencies like TypeScript)
COPY package*.json ./
RUN npm install --omit=dev
RUN apk add --no-cache ffmpeg ca-certificates && \
npm install --omit=dev

# Copy the compiled JS from the builder stage
COPY --from=builder /app/dist ./dist

# Start the app
EXPOSE 3000
CMD ["node", "dist/index.js"]
CMD ["node", "dist/utils/index.js"]
7 changes: 5 additions & 2 deletions backend/src/services/transcription.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ const TEMP_DIR = path.resolve(ROOT_DIR, 'temp_audio');
const SOURCE_AUDIO = path.resolve(TEMP_DIR, 'source_audio.mp3');

// Configure FFmpeg paths
if (ffmpegStatic) {
if (process.env.NODE_ENV === 'production') {
// In production (Docker), we prefer the system-installed ffmpeg
console.log("Using system ffmpeg in production");
} else if (ffmpegStatic) {
ffmpeg.setFfmpegPath(ffmpegStatic);
} else {
throw new Error("FFmpeg binary path could not be resolved.");
console.warn("ffmpeg-static path could not be resolved, falling back to system ffmpeg.");
}

if (ffprobeStatic && ffprobeStatic.path) {
Expand Down
8 changes: 8 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
services:
web:
image: ghcr.io/edwardrl101/ai-lecture-video-helper:latest
ports:
- "80:3000"
pull_policy: always
env_file:
- .env
Loading