35 lines
806 B
Docker
35 lines
806 B
Docker
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
|
|
COPY . .
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -o adonis .
|
|
|
|
FROM alpine
|
|
|
|
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
|
|
EXPOSE 80
|
|
|
|
# Run
|
|
ENTRYPOINT ["/app/adonis"]
|