-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ebdba98
commit 75d83ee
Showing
1 changed file
with
7 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,17 @@ | ||
# Start from the official Go image | ||
FROM golang:1.17-alpine | ||
# Use Go version 1.20 image | ||
FROM golang:1.20-alpine | ||
|
||
# Set the Current Working Directory inside the container | ||
# Set the working directory inside the container | ||
WORKDIR /app | ||
|
||
# Copy go mod and sum files | ||
# Copy go.mod and go.sum files to the working directory | ||
COPY go.mod go.sum ./ | ||
|
||
# Download all dependencies. Dependencies will be cached if the go.mod and go.sum files are not changed | ||
# Download all dependencies | ||
RUN go mod download | ||
|
||
# Copy the source code into the container | ||
# Copy the source code to the working directory | ||
COPY . . | ||
|
||
# Build the Go app | ||
RUN go build -o main . | ||
|
||
# Command to run the executable | ||
CMD ["./main"] | ||
RUN go build -o main . |