CI / build (push) Successful in 54s
A Go server that takes product uploads with hub upload tokens, checks them by t5de-api's pack rules, stores files by sha256, registers revisions with the hub (POST /api/v1/catalog/revisions), and serves files with immutable caching; files used only by adult revisions need an adult access token. Contract: t5de-hub's docs/products.md. Co-Authored-By: Claude Opus 5.5 <[email protected]>
27 lines
1014 B
Docker
27 lines
1014 B
Docker
# t5de-catalog in a container: a static build on distroless. Data (catalog.db, files/) goes in the /data volume.
|
|
#
|
|
# docker build -t t5de-catalog .
|
|
# docker run -p 4102:4102 -v catalog-data:/data -e HUB_URL=... -e CATALOG_ID=... -e CATALOG_KEY=... \
|
|
# -e CATALOG_PUBLIC_URL=... -e WEB_ORIGIN=... t5de-catalog
|
|
FROM golang:1.27-alpine AS build
|
|
RUN apk add --no-cache git
|
|
# T5DE's modules (t5de-api) come straight from its Gitea.
|
|
ENV GOPRIVATE=git.t5de.dev CGO_ENABLED=0
|
|
ARG VERSION=dev
|
|
WORKDIR /src
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
COPY . .
|
|
RUN go build -trimpath -buildvcs=false \
|
|
-ldflags "-s -w -buildid= -X git.t5de.dev/t5de/t5de-catalog/internal/buildinfo.Version=${VERSION}" \
|
|
-o /out/t5de-catalog ./cmd/t5de-catalog \
|
|
&& mkdir /out/data
|
|
|
|
FROM gcr.io/distroless/static-debian12:nonroot
|
|
COPY --from=build /out/t5de-catalog /t5de-catalog
|
|
COPY --from=build --chown=nonroot:nonroot /out/data /data
|
|
ENV CATALOG_ADDR=0.0.0.0:4102 CATALOG_DATA=/data
|
|
VOLUME /data
|
|
EXPOSE 4102
|
|
ENTRYPOINT ["/t5de-catalog"]
|