blob: 6f30192a64e7dade7bfc0bb67c60cf0bbcb4ebe2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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"]
|