Skip to content

Commit 012d944

Browse files
author
Shailza Thakur
committed
Update Dockerfile to use distroless image
1 parent bc4cd41 commit 012d944

File tree

1 file changed

+31
-9
lines changed

1 file changed

+31
-9
lines changed

code-engine-cos2cos/Dockerfile

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,47 @@
1-
FROM golang:1.23-alpine as builder
1+
# FROM golang:1.23-alpine as builder
22

3-
WORKDIR /app
3+
# WORKDIR /app
44

5-
COPY go.mod go.sum ./
5+
# COPY go.mod go.sum ./
66

7-
RUN go mod tidy
7+
# RUN go mod tidy
8+
9+
# COPY . .
10+
11+
# # Build the Go application for Linux, stripped of debug information
12+
# RUN CGO_ENABLED=0 GOOS=linux go build -o cos2cos
13+
14+
# # Stage 2: Final stage (minimal image)
15+
# FROM alpine
16+
17+
# RUN apk --no-cache add ca-certificates
18+
19+
20+
# # Copy the binary from the builder stage
21+
# COPY --from=builder /app/cos2cos /
22+
23+
# RUN chmod +x /cos2cos
24+
25+
# ENTRYPOINT ["/cos2cos"]
26+
27+
28+
FROM quay.io/projectquay/golang:1.23 AS builder
29+
WORKDIR /go/src/app
830

931
COPY . .
1032

33+
RUN go mod tidy
34+
1135
# Build the Go application for Linux, stripped of debug information
1236
RUN CGO_ENABLED=0 GOOS=linux go build -o cos2cos
1337

1438
# Stage 2: Final stage (minimal image)
15-
FROM alpine
39+
FROM gcr.io/distroless/static-debian12
1640

17-
RUN apk --no-cache add ca-certificates
41+
# RUN apk --no-cache add ca-certificates
1842

1943

2044
# Copy the binary from the builder stage
21-
COPY --from=builder /app/cos2cos /
22-
23-
RUN chmod +x /cos2cos
45+
COPY --from=builder /go/src/app/cos2cos /
2446

2547
ENTRYPOINT ["/cos2cos"]

0 commit comments

Comments
 (0)