diff options
Diffstat (limited to 'player-server/Dockerfile')
| -rw-r--r-- | player-server/Dockerfile | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/player-server/Dockerfile b/player-server/Dockerfile new file mode 100644 index 0000000..6f30192 --- /dev/null +++ b/player-server/Dockerfile @@ -0,0 +1,37 @@ +# syntax=docker/dockerfile:1 + +# ---- Builder stage ---- +FROM golang:1.25-alpine AS builder + +WORKDIR /build + +# Install git for go mod download if needed. +RUN apk add --no-cache git + +COPY go.mod go.sum ./ +RUN go mod download + +COPY . . + +# Build the binary. +RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o player ./cmd/player + +# ---- Runtime stage ---- +FROM alpine:3.21 + +# Install ffmpeg and ffprobe. +RUN apk add --no-cache ffmpeg + +# Create a non-root user (nobody already exists as 65534). +USER 65534:65534 + +WORKDIR /app + +# Copy the binary and static assets from the builder. +COPY --from=builder --chown=65534:65534 /build/player /app/player +COPY --from=builder --chown=65534:65534 /build/web /app/web + +# Expose the default HTTP port. +EXPOSE 8080 + +ENTRYPOINT ["/app/player"] |
