-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
72 lines (44 loc) · 1.54 KB
/
Dockerfile
File metadata and controls
72 lines (44 loc) · 1.54 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# Multi-stage Dockerfile for building causality services
# Build stage
FROM golang:1.24-alpine AS builder
# Install build dependencies
RUN apk add --no-cache git ca-certificates
# Set working directory
WORKDIR /app
# Copy go mod files first for better caching
COPY go.mod go.sum ./
# Download dependencies
RUN go mod download
# Copy source code
COPY . .
# Build server
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -s" -o /bin/causality-server ./cmd/server
# Build warehouse-sink
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -s" -o /bin/warehouse-sink ./cmd/warehouse-sink
# Build reaction-engine
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -s" -o /bin/reaction-engine ./cmd/reaction-engine
# Server image
FROM alpine:3.19 AS server
RUN apk add --no-cache ca-certificates wget
# Create non-root user
RUN adduser -D -g '' appuser
USER appuser
COPY --from=builder /bin/causality-server /usr/local/bin/causality-server
EXPOSE 8080
ENTRYPOINT ["/usr/local/bin/causality-server"]
# Warehouse sink image
FROM alpine:3.19 AS warehouse-sink
RUN apk add --no-cache ca-certificates
# Create non-root user
RUN adduser -D -g '' appuser
USER appuser
COPY --from=builder /bin/warehouse-sink /usr/local/bin/warehouse-sink
ENTRYPOINT ["/usr/local/bin/warehouse-sink"]
# Reaction engine image
FROM alpine:3.19 AS reaction-engine
RUN apk add --no-cache ca-certificates
# Create non-root user
RUN adduser -D -g '' appuser
USER appuser
COPY --from=builder /bin/reaction-engine /usr/local/bin/reaction-engine
ENTRYPOINT ["/usr/local/bin/reaction-engine"]