-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
33 lines (24 loc) · 742 Bytes
/
Dockerfile
File metadata and controls
33 lines (24 loc) · 742 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
# Build stage
FROM docker.io/library/golang:1.25 AS builder
# Set the working directory inside the container
WORKDIR /app
# Copy the Go module files and application source code
COPY go.mod go.sum ./
# Download dependencies
RUN go mod download
# Copy source code
COPY ./helloworld ./helloworld
COPY ./client ./client
COPY ./server ./server
ARG DIRECTORY=server
# Build the gRPC server application
RUN CGO_ENABLED=0 GOOS=linux go build -o app ${DIRECTORY}/main.go
# Final stage
FROM scratch
# Copy the built executable from the builder stage
COPY --from=builder /app/app /app/app
# Set the working directory inside the container
WORKDIR /app
# Command to run the application
ENTRYPOINT [ "/app/app" ]
CMD [ "-delay=0", "-port=50051" ]