Skip to content

Commit fc843bc

Browse files
committed
dockerfile changes
1 parent a4ebe16 commit fc843bc

1 file changed

Lines changed: 7 additions & 16 deletions

File tree

go/samples/http/Dockerfile

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,16 @@
1-
# Build Stage
21
# First pull Golang image
3-
FROM golang:1.19-alpine as build-env
2+
FROM golang:1.19-alpine
43

54
ENV APP_NAME sqlcommenter-http
6-
ENV CMD_PATH main.go
7-
8-
# Copy application data into image
9-
COPY . $GOPATH/src/$APP_NAME
5+
6+
# Set workdir
107
WORKDIR $GOPATH/src/$APP_NAME
8+
9+
# Copy application data into image
10+
COPY . .
1111

1212
# Budild application
13-
RUN CGO_ENABLED=0 go build -v -o /$APP_NAME $GOPATH/src/$APP_NAME/$CMD_PATH
14-
15-
# Run Stage
16-
FROM alpine:3.16.3
17-
18-
# Set environment variable
19-
ENV APP_NAME sqlcommenter-http
20-
21-
# Copy only required data into this image
22-
COPY --from=build-env /$APP_NAME .
13+
RUN CGO_ENABLED=0 go build -v
2314

2415
# Expose application port
2516
EXPOSE 8081

0 commit comments

Comments
 (0)