Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 3m7s
37 lines
1.1 KiB
Docker
37 lines
1.1 KiB
Docker
# Stage 1: Build the Go application
|
|
FROM golang:1.21-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
# Mock basic go mod init so it can build without external pre-requisites
|
|
RUN go mod init ai-media-hub && \
|
|
go get github.com/gofiber/fiber/v2 github.com/gofiber/fiber/v2/middleware/cors github.com/gofiber/fiber/v2/middleware/logger github.com/gofiber/websocket/v2
|
|
COPY backend/ ./backend/
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -o /ai-media-hub ./backend/main.go
|
|
|
|
# Stage 2: Final runtime container with Python & Go binary
|
|
FROM python:3.10-slim
|
|
|
|
WORKDIR /app
|
|
|
|
# Install dependencies (ffmpeg for yt-dlp processing)
|
|
RUN apt-get update && \
|
|
apt-get install -y --no-install-recommends ffmpeg curl ca-certificates && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
# Install Python worker requirements
|
|
COPY worker/requirements.txt ./
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy Go binary from builder
|
|
COPY --from=builder /ai-media-hub /app/ai-media-hub
|
|
|
|
# Copy Frontend files and worker files
|
|
COPY frontend/ ./frontend/
|
|
COPY worker/ ./worker/
|
|
|
|
# Expose port (Internal 8000)
|
|
EXPOSE 8000
|
|
|
|
# Entrypoint: Run Go backend
|
|
CMD ["/app/ai-media-hub"]
|