-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
33 lines (21 loc) · 707 Bytes
/
Dockerfile
File metadata and controls
33 lines (21 loc) · 707 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# 1. stage: build
FROM golang:1.25-alpine AS builder
WORKDIR /app
# go mod dosyaları
COPY go.mod go.sum ./
RUN go mod download
# tüm proje
COPY . .
# statik binary (CGO kapalı, minimal)
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o event-metrics-service ./cmd/api
# 2. stage: runtime
FROM alpine:3.20
WORKDIR /app
# küçük runtime dependency'ler (opsiyonel)
RUN apk add --no-cache ca-certificates
COPY --from=builder /app/event-metrics-service /app/event-metrics-service
# Migrations'ları da image içine koymak istersen:
COPY migrations /app/migrations
ENV POSTGRES_DSN=postgres://user:password@postgres:5432/eventdb?sslmode=disable
EXPOSE 8080
CMD ["/app/event-metrics-service"]