<!-- Provide a brief summary of your changes --> ## Motivation and Context <!-- Why is this change needed? What problem does it solve? --> The following PR: * Bumps Go to the latest stable version * Moves away from setting the Go version as an env var in favour of reading it automatically from the go.mod file (better consistency) Closes: #447 ## How Has This Been Tested? <!-- Have you tested this in a real application? Which scenarios were tested? --> Locally ## Breaking Changes <!-- Will users need to update their code or configurations? --> No ## Types of changes <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation update ## Checklist <!-- Go over all the following points, and put an `x` in all the boxes that apply. --> - [ ] I have read the [MCP Documentation](https://modelcontextprotocol.io) - [ ] My code follows the repository's style guidelines - [ ] New and existing tests pass locally - [ ] I have added appropriate error handling - [ ] I have added or updated documentation as needed ## Additional context <!-- Add any other context, implementation notes, or design decisions --> --------- Signed-off-by: Radoslav Dimitrov <radoslav@stacklok.com>
35 lines
869 B
Docker
35 lines
869 B
Docker
FROM golang:1.25-alpine AS builder
|
|
WORKDIR /app
|
|
|
|
# Copy go mod files first and download dependencies
|
|
# This creates a separate layer that only invalidates when dependencies change
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
|
|
# Copy the rest of the source code
|
|
COPY . .
|
|
|
|
ARG GO_BUILD_TAGS
|
|
RUN go build ${GO_BUILD_TAGS:+-tags="$GO_BUILD_TAGS"} -o /build/registry ./cmd/registry
|
|
|
|
FROM alpine:latest
|
|
WORKDIR /app
|
|
COPY --from=builder /build/registry .
|
|
COPY --from=builder /app/data/seed.json /app/data/seed.json
|
|
|
|
# Create a non-privileged user that the app will run under.
|
|
# See https://docs.docker.com/go/dockerfile-user-best-practices/
|
|
ARG UID=10001
|
|
RUN adduser \
|
|
--disabled-password \
|
|
--gecos "" \
|
|
--home "/nonexistent" \
|
|
--shell "/sbin/nologin" \
|
|
--no-create-home \
|
|
--uid "${UID}" \
|
|
appuser
|
|
|
|
USER appuser
|
|
EXPOSE 8080
|
|
|
|
ENTRYPOINT ["./registry"]
|