32 lines
		
	
	
		
			715 B
		
	
	
	
		
			Docker
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
		
			715 B
		
	
	
	
		
			Docker
		
	
	
	
	
	
# https://docs.docker.com/guides/golang/build-images/
 | 
						|
 | 
						|
# syntax=docker/dockerfile:1
 | 
						|
 | 
						|
# Build the application from source
 | 
						|
FROM golang:1.25.1-bookworm 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
 | 
						|
# TODO: Move to alpine
 | 
						|
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"] |