The python:3.12-slim base pushed a 30 MB layer that timed out on the way to Harbor (Cloudflare 524). A static Go binary keeps the image near 5 MB with the same endpoints, port and APP_MESSAGE variable.
20 lines
648 B
Docker
20 lines
648 B
Docker
# The AISP build gateway only allows base images from approved mirrors, written with the
|
|
# full host (docker.io/..., harbor.vts-ai.space/...).
|
|
FROM docker.io/library/golang:1.23-alpine AS build
|
|
WORKDIR /src
|
|
COPY go.mod main.go ./
|
|
RUN CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o /out/server .
|
|
|
|
# A static binary on scratch keeps the pushed image to a few MB; large layers time out
|
|
# on the way to Harbor.
|
|
FROM scratch
|
|
COPY --from=build /out/server /server
|
|
|
|
# AISP enforces PodSecurity "restricted": run as a non-root UID on a port above 1024.
|
|
USER 10001
|
|
ENV PORT=8080 \
|
|
APP_MESSAGE="Hello from AISP"
|
|
EXPOSE 8080
|
|
|
|
ENTRYPOINT ["/server"]
|