diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-17 15:25:52 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-17 15:25:52 +0300 |
| commit | 914bd7cd6aa14e839332a98d91c30b19865b0cf2 (patch) | |
| tree | 02b11537237a204048589e14ed24938b805e42f7 /player-server/Dockerfile | |
| parent | 3b24f0e1be832584d6550e8cc3e5d24329f66f90 (diff) | |
Restructure repo: move Go server into player-server/
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"] |
