-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
35 lines (25 loc) · 767 Bytes
/
Dockerfile
File metadata and controls
35 lines (25 loc) · 767 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
# --- Stage 1: Builder ---
FROM golang:1.24-alpine AS builder
WORKDIR /app
# Install build tools
RUN apk add --no-cache git make
# Copy dependencies first
COPY go.mod go.sum ./
RUN go mod download
# Copy source code
COPY . .
# Build Master and Agent binaries
RUN CGO_ENABLED=0 GOOS=linux go build -o /bin/cloudsync-master ./master/cmd/server/main.go
RUN CGO_ENABLED=0 GOOS=linux go build -o /bin/cloudsync-agent ./agent/cmd/agent/main.go
# --- Stage 2: Runtime ---
FROM alpine:latest
WORKDIR /app
RUN apk --no-cache add curl
COPY --from=builder /bin/cloudsync-master /app/master
COPY --from=builder /bin/cloudsync-agent /app/agent
RUN mkdir -p /data/metadata /data/storage
# EXPOSE the new ports
EXPOSE 8080
EXPOSE 50051
EXPOSE 5000
CMD ["/app/master"]