31 lines
665 B
Docker
31 lines
665 B
Docker
# https://docs.docker.com/guides/golang/build-images/
|
|
|
|
# syntax=docker/dockerfile:1
|
|
|
|
# Build the application from source
|
|
FROM golang:1.24.3 AS build-stage
|
|
|
|
WORKDIR /app
|
|
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
|
|
COPY cmd/ ./
|
|
COPY internal ./
|
|
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -o /CatsOfMastodonGo cmd/CatsOfMastodonBotGo/main.go
|
|
|
|
# Deploy the application binary into a lean image
|
|
FROM gcr.io/distroless/static-debian12 AS build-release-stage
|
|
|
|
WORKDIR /
|
|
|
|
COPY --from=build-stage /CatsOfMastodonGo /CatsOfMastodonGo
|
|
COPY --from=build-stage /app/internal/web/templates /internal/web/templates
|
|
|
|
|
|
EXPOSE 8080
|
|
|
|
USER nonroot:nonroot
|
|
|
|
ENTRYPOINT ["/CatsOfMastodonGo"] |