-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathDockerfile
More file actions
32 lines (22 loc) · 787 Bytes
/
Dockerfile
File metadata and controls
32 lines (22 loc) · 787 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
# Stage 1: Build the application
FROM golang:1.22-alpine AS builder
WORKDIR /app
# Copy go.mod and go.sum to download dependencies first
COPY go.mod go.sum ./
RUN go mod download
# Copy the rest of the source code
COPY . .
# Build the application, statically linking it
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o /m3s-server ./cmd/server
# Stage 2: Create the final, minimal image
FROM alpine:latest
WORKDIR /app
# Copy the compiled binary from the builder stage
COPY --from=builder /m3s-server .
# Copy the configuration directory
COPY configs/ ./configs/
# Expose the default port the application runs on
EXPOSE 18061
# The .env file should be provided at runtime, e.g., via a volume or config map
# ENTRYPOINT ["/app/m3s-server"]
CMD ["/app/m3s-server"]