Spaces:
Paused
Paused
| # STAGE 1: Build the Go Binary | |
| FROM golang:1.25-bookworm AS builder | |
| WORKDIR /app | |
| # Copy dependency files | |
| COPY go.mod go.sum ./ | |
| RUN go mod download | |
| # Copy source and build | |
| COPY . . | |
| RUN go build -o media-app main.go | |
| # --------------------------------------------------------- | |
| # STAGE 2: Clean Runtime (no Pinggy, no SSH) | |
| FROM debian:bookworm-slim | |
| WORKDIR /app | |
| # Install FFmpeg, Unrar, CA certificates | |
| RUN sed -i 's/main/main contrib non-free non-free-firmware/g' /etc/apt/sources.list.d/debian.sources && \ | |
| apt-get update && \ | |
| apt-get install -y ffmpeg unrar ca-certificates && \ | |
| rm -rf /var/lib/apt/lists/* | |
| # Copy binary and templates | |
| COPY --from=builder /app/media-app . | |
| COPY --from=builder /app/templates ./templates | |
| # Create folders | |
| RUN mkdir -p downloads output | |
| # Simple startup script (no tunneling) | |
| RUN echo '#!/bin/bash' > /app/start.sh && \ | |
| echo 'echo "Starting Media App..."' >> /app/start.sh && \ | |
| echo './media-app' >> /app/start.sh && \ | |
| chmod +x /app/start.sh | |
| EXPOSE 8080 | |
| CMD ["/app/start.sh"] | |