Adding deployment file
This commit is contained in:
23
Dockerfile
Normal file
23
Dockerfile
Normal file
@ -0,0 +1,23 @@
|
||||
# specify the base image to be used for the application
|
||||
FROM golang:1.21.4-alpine
|
||||
|
||||
# create the working directory in the image
|
||||
WORKDIR /app
|
||||
|
||||
# copy Go modules and dependencies to image
|
||||
COPY go.mod ./
|
||||
|
||||
# download Go modules and dependencies
|
||||
RUN go mod download
|
||||
|
||||
# copy all the Go files ending with .go extension
|
||||
COPY *.go ./
|
||||
|
||||
# compile application
|
||||
RUN go build -o /golang-http-header
|
||||
|
||||
# network port at runtime
|
||||
EXPOSE 8000
|
||||
|
||||
# execute when the container starts
|
||||
CMD [ "/golang-http-header" ]
|
Reference in New Issue
Block a user