Files
Levyraati26_go/Dockerfile
T
Esa Kataja b01d08b1e1 Move the package into src/
Thirty-seven entries in the root, most of them .go files. The assets had to
come along: //go:embed cannot reach outside its own directory, so
templates/, static/ and migrations/ live beside the code that embeds them,
and testdata/ beside the test that reads it. storage/ stays put — runtime
data, not source.

go build now needs -o. Without it the output would be named after the
package directory and collide with src/ itself.
2026-09-05 13:53:04 +03:00

20 lines
875 B
Docker

FROM golang:1.27-alpine AS build
# CalVer, injected at build so no file needs bumping by hand: docker build --build-arg VERSION=…
ARG VERSION=dev
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 go build -ldflags "-X main.version=${VERSION}" -o /levyraati ./src
FROM alpine:3.24
# yt-dlp rots against YouTube. Alpine's active branch tracks it closely (3.24 carries the current
# release), so a rebuild is the update — and this avoids python3 + pip in the image entirely.
# sqlite is the CLI only — the app links its own pure-Go copy. It is here so `.backup` and a shell
# are reachable with docker compose exec, which is the whole of database operations now.
RUN apk add --no-cache ffmpeg yt-dlp ca-certificates sqlite
COPY --from=build /levyraati /usr/local/bin/levyraati
ENV STORAGE_DIR=/storage
EXPOSE 8080
ENTRYPOINT ["levyraati"]