From 4d71aabf4feb1dcb9c940926fbcc4285525b1c05 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Wed, 29 Apr 2026 09:57:35 +0300 Subject: feat: Create Dockerfile, k8s manifests, and Magefile.go with build/test/install targets (p9) --- Dockerfile | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Dockerfile (limited to 'Dockerfile') diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5654691 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,37 @@ +# syntax=docker/dockerfile:1 + +# ---- Builder stage ---- +FROM golang:1.23-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 play ./cmd/mediaplayer + +# ---- 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/play /app/play +COPY --from=builder --chown=65534:65534 /build/web /app/web + +# Expose the default HTTP port. +EXPOSE 8080 + +ENTRYPOINT ["/app/play"] -- cgit v1.2.3