-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
30 lines (21 loc) · 664 Bytes
/
Dockerfile
File metadata and controls
30 lines (21 loc) · 664 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
# Use the official Golang image to create a build artifact.
FROM golang:1.23.4 as builder
# Set the working directory inside the container.
WORKDIR /app
# Copy the Go module files and download dependencies.
COPY go.mod go.sum ./
RUN go mod download
# Copy the rest of the application code.
COPY . .
# Build the Go application.
RUN CGO_ENABLED=0 GOOS=linux go build -o got .
# Use a minimal Alpine image for the final stage.
FROM alpine:latest
# Set the working directory.
WORKDIR /root/
# Copy the binary from the builder stage.
COPY --from=builder /app/got .
# Expose the port the app runs on.
EXPOSE 8080
# Command to run the application.
CMD ["./got"]