Some checks failed
Build and Push Docker Image / build-and-push (push) Has been cancelled
43 lines
1.1 KiB
Docker
43 lines
1.1 KiB
Docker
# 1. Build Go Backend
|
|
FROM golang:1.21-alpine AS builder
|
|
WORKDIR /app
|
|
# TODO: go mod init & go mod download will be added later when we create the go backend code
|
|
# COPY backend/go.mod backend/go.sum ./backend/
|
|
# RUN cd backend && go mod download
|
|
COPY backend/ ./backend/
|
|
# We'll build the go binary inside the backend dir and put it in /app/main
|
|
RUN cd backend && CGO_ENABLED=1 go build -o /app/main main.go
|
|
|
|
# 2. Final Minimal Image (Python + Go binary + Frontend)
|
|
FROM python:3.10-slim
|
|
|
|
# Install system dependencies (ffmpeg is required for yt-dlp)
|
|
RUN apt-get update && apt-get install -y \
|
|
ffmpeg \
|
|
ca-certificates \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /app
|
|
|
|
# Install Python dependencies for worker
|
|
COPY worker/requirements.txt ./worker/
|
|
RUN pip install --no-cache-dir -r worker/requirements.txt
|
|
|
|
# Copy Go binary from builder
|
|
COPY --from=builder /app/main ./main
|
|
|
|
# Copy worker script
|
|
COPY worker/ ./worker/
|
|
|
|
# Copy frontend
|
|
COPY frontend/ ./frontend/
|
|
|
|
# Ensure directories exist
|
|
RUN mkdir -p db downloads
|
|
|
|
# Expose Go server port
|
|
EXPOSE 3000
|
|
|
|
# Run the Go server command (which will also call the yt-dlp python script when needed)
|
|
CMD ["./main"]
|