adonis/Dockerfile

26 lines
485 B
Docker

# build stage
FROM golang:1.22-alpine AS build
WORKDIR /src
# Download Go modules
COPY go.mod go.sum ./
RUN go mod download
# 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
COPY --from=build /src/adonis .
COPY --from=build /src/static ./static
# application binds to 80 by default
EXPOSE 80
ENTRYPOINT ["/app/adonis"]