mirror of
https://github.com/mariocandela/beelzebub.git
synced 2025-07-01 18:47:26 -04:00
36 lines
661 B
Docker
36 lines
661 B
Docker
![]() |
FROM golang:alpine AS builder
|
||
|
|
||
|
ENV GO111MODULE=on \
|
||
|
CGO_ENABLED=0 \
|
||
|
GOOS=linux \
|
||
|
GOARCH=amd64
|
||
|
|
||
|
RUN apk add git
|
||
|
|
||
|
WORKDIR /build
|
||
|
|
||
|
# Copy and download dependency using go mod
|
||
|
COPY go.mod .
|
||
|
COPY go.sum .
|
||
|
RUN go mod download
|
||
|
|
||
|
# Copy the code into the container
|
||
|
COPY . .
|
||
|
COPY ./configurations /dist/configurations
|
||
|
|
||
|
# Build the application
|
||
|
RUN go build -o main .
|
||
|
|
||
|
# Move to /dist directory as the place for resulting binary folder
|
||
|
WORKDIR /dist
|
||
|
|
||
|
# Copy binary from build to main folder
|
||
|
RUN cp /build/main .
|
||
|
|
||
|
# Build a small image
|
||
|
FROM scratch
|
||
|
|
||
|
COPY --from=builder /dist/main /
|
||
|
COPY --from=builder /dist/configurations /configurations
|
||
|
|
||
|
ENTRYPOINT ["/main"]
|