Skip to content

Commit 7db5437

Browse files
committed
chore: docker file 수정
- ENV 설정 분리 - 불필요한 플래그 제거 - deployment stage naming - 불필요한 certifiacation 커맨드 제거
1 parent b066de3 commit 7db5437

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

Dockerfile

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Build Stage
22
FROM golang:1.23.4 AS builder
3+
ENV CGO_ENABLED=0 \
4+
GOOS=linux
35

46
WORKDIR /app
57

@@ -12,17 +14,14 @@ RUN go mod download
1214
COPY . ./
1315

1416
# Disable CGO and set target OS to Linux for a portable static binary
15-
RUN CGO_ENABLED=0 GOOS=linux go build -v -o /techbloghub-server ./cmd/main.go
17+
RUN go build -o /techbloghub-server ./cmd/main.go
1618

1719

1820
# Final Stage
19-
FROM alpine:latest
20-
21-
# add package
22-
RUN apk --no-cache add ca-certificates
21+
FROM alpine:latest AS deployment
2322

2423
# copy only built binaries
25-
COPY --from=builder /techbloghub-server /techbloghub-server
24+
COPY --from=builder /techbloghub-server ./
2625

2726
# Optional:
2827
# To bind to a TCP port, runtime parameters must be supplied to the docker command.
@@ -32,4 +31,4 @@ COPY --from=builder /techbloghub-server /techbloghub-server
3231
EXPOSE 8080
3332

3433
# Run
35-
CMD ["/techbloghub-server"]
34+
CMD ["./techbloghub-server"]

0 commit comments

Comments
 (0)