restructure repo, separate sample app from docker configs
This commit is contained in:
17
06-building-container-images/api-golang/Dockerfile.3
Normal file
17
06-building-container-images/api-golang/Dockerfile.3
Normal file
@ -0,0 +1,17 @@
|
||||
# Pin specific version for stability
|
||||
# Use alpine for reduced image size
|
||||
FROM golang:1.19-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy only files required to install dependencies (better layer caching)
|
||||
COPY go.mod go.sum ./
|
||||
|
||||
RUN go mod download
|
||||
|
||||
COPY . .
|
||||
|
||||
# Compile application during build rather than at runtime
|
||||
RUN go build -o api-golang
|
||||
|
||||
CMD ["./api-golang"]
|
||||
Reference in New Issue
Block a user