trimmed extra comments and described two build stages
This commit is contained in:
parent
f0d486fd6c
commit
7088a05f8e
17
Dockerfile
17
Dockerfile
@ -1,20 +1,17 @@
|
||||
# build stage
|
||||
FROM golang:1.22-alpine AS build
|
||||
|
||||
# Set destination for COPY of gui files
|
||||
WORKDIR /src
|
||||
|
||||
# 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/reference/dockerfile/#copy
|
||||
# COPY *.go ./
|
||||
|
||||
# RUN CGO_ENABLED=0 GOOS=linux go build -o /adonis
|
||||
# this could be simplified a lot by being stricter on what we copy.
|
||||
COPY . .
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -o adonis .
|
||||
|
||||
# copy only binary and static files to slim image size
|
||||
FROM alpine
|
||||
|
||||
WORKDIR /app
|
||||
@ -22,13 +19,7 @@ WORKDIR /app
|
||||
COPY --from=build /src/adonis .
|
||||
COPY --from=build /src/static ./static
|
||||
|
||||
# Build
|
||||
# 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/reference/dockerfile/#expose
|
||||
# application binds to 80 by default
|
||||
EXPOSE 80
|
||||
|
||||
# Run
|
||||
ENTRYPOINT ["/app/adonis"]
|
||||
|
Loading…
x
Reference in New Issue
Block a user