Skip to content

Commit

Permalink
Add a Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
sywhb committed Feb 9, 2023
1 parent 0f2af67 commit 9c70911
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM golang:1.19-alpine

# Set the Current Working Directory inside the container
WORKDIR /app

# pre-copy/cache go.mod for pre-downloading dependencies and only redownloading them in subsequent builds if they change
COPY go.mod go.sum ./
RUN go mod download && go mod verify

# Copy everything from the current directory to the PWD(Present Working Directory) inside the container
COPY . .

# Build the Go app
RUN go build -o app .

# Expose port 8080 to the outside world
EXPOSE 8080

# Command to run the executable
CMD ["./app"]

0 comments on commit 9c70911

Please sign in to comment.