-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.server
More file actions
40 lines (29 loc) · 774 Bytes
/
Dockerfile.server
File metadata and controls
40 lines (29 loc) · 774 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
40
# =========================
# Stage 1: Build stage
# =========================
FROM golang:1.25.1 AS builder
# Set working directory inside the container
WORKDIR /app
# Enable Go modules
ENV GO111MODULE=on
ENV CGO_ENABLED=0
# Copy go.mod and go.sum first for caching
COPY go.mod go.sum ./
# Download dependencies
RUN go mod download
# Copy the rest of the project
COPY . .
# Expose the port (if needed)
EXPOSE ${PORT}
# Build the binary from ./cmd/server/main.go
RUN go build -o s3clone ./cmd/server/main.go
# =========================
# Stage 2: Runtime stage
# =========================
FROM debian:bookworm-slim
# Set working directory
WORKDIR /app
# Copy the compiled binary from builder
COPY --from=builder /app/s3clone .
# Default command
CMD ["./s3clone"]