Files
CatsOfMastodonGo/Dockerfile

31 lines
683 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 /app/cmd/
COPY internal /app/internal/
RUN CGO_ENABLED=1 GOOS=linux go build -o /CatsOfMastodonGo ./cmd/CatsOfMastodonBotGo/main.go
# Deploy the application binary into a lean image
FROM gcr.io/distroless/base-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
ENV GIN_MODE=release
ENTRYPOINT ["/CatsOfMastodonGo"]