You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
611 B
Docker
26 lines
611 B
Docker
1 year ago
|
FROM golang:1.21
|
||
|
|
||
|
# Set destination for COPY
|
||
|
WORKDIR /app
|
||
|
|
||
|
# Download Go modules
|
||
|
COPY go.mod go.sum ./
|
||
|
RUN go mod download
|
||
|
|
||
|
# Copy the source code. Note the slash at the end, as explained in
|
||
|
# https://docs.docker.com/engine/reference/builder/#copy
|
||
|
COPY *.go ./
|
||
|
|
||
|
# Build
|
||
|
RUN CGO_ENABLED=0 GOOS=linux go build -o /listy
|
||
|
|
||
|
# Optional:
|
||
|
# To bind to a TCP port, runtime parameters must be supplied to the docker command.
|
||
|
# But we can document in the Dockerfile what ports
|
||
|
# the application is going to listen on by default.
|
||
|
# https://docs.docker.com/engine/reference/builder/#expose
|
||
|
EXPOSE 5001
|
||
|
|
||
|
# Run
|
||
|
CMD ["/listy"]
|