-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (26 loc) · 764 Bytes
/
Dockerfile
File metadata and controls
39 lines (26 loc) · 764 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
34
35
36
37
38
39
FROM golang:1.25.7-alpine AS builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
ENV CGO_ENABLED=0 \
GOOS=linux
RUN go build -trimpath -ldflags="-s -w" -o bin/server ./cmd/main.go
FROM alpine:3.21
WORKDIR /app
ENV ENV=prod \
HOST=0.0.0.0 \
PORT=5001 \
POSTGRES_URL=postgres://postgres:postgres@postgres:5432/benchmarks \
MONGODB_URL=mongodb://mongodb:27017 \
MONGODB_DB=benchmarks \
REDIS_URL=redis://redis:6379 \
CASSANDRA_CONTACT_POINTS=cassandra \
CASSANDRA_KEYSPACE=benchmarks \
CASSANDRA_LOCAL_DATACENTER=datacenter1
COPY --from=builder /app/bin/server .
RUN addgroup -g 1001 -S app-group && \
adduser -S app-runner -u 1001 -G app-group
USER app-runner
EXPOSE 5001
CMD ["./server"]