Skip to content

Commit

Permalink
dockerfile changes
Browse files Browse the repository at this point in the history
  • Loading branch information
kapv89 committed Nov 23, 2022
1 parent a4ebe16 commit fc843bc
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions go/samples/http/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,16 @@
# Build Stage
# First pull Golang image
FROM golang:1.19-alpine as build-env
FROM golang:1.19-alpine

ENV APP_NAME sqlcommenter-http
ENV CMD_PATH main.go

# Copy application data into image
COPY . $GOPATH/src/$APP_NAME

# Set workdir
WORKDIR $GOPATH/src/$APP_NAME

# Copy application data into image
COPY . .

# Budild application
RUN CGO_ENABLED=0 go build -v -o /$APP_NAME $GOPATH/src/$APP_NAME/$CMD_PATH

# Run Stage
FROM alpine:3.16.3

# Set environment variable
ENV APP_NAME sqlcommenter-http

# Copy only required data into this image
COPY --from=build-env /$APP_NAME .
RUN CGO_ENABLED=0 go build -v

# Expose application port
EXPOSE 8081
Expand Down

0 comments on commit fc843bc

Please sign in to comment.