dcbot/build/docker/dcbot/prod/Dockerfile

23 lines
473 B
Docker

FROM golang:1.20.5-alpine3.18 as builder
WORKDIR /dcbot
COPY go.mod go.sum ./
RUN go mod download
RUN apk --no-cache add make
COPY . .
RUN make generate
ARG DRONE_TAG="development"
RUN CGO_ENABLED=0 go build -ldflags "-X main.version=${DRONE_TAG##v}" -trimpath -o dcbot ./cmd/dcbot/main.go
######## Start a new stage from scratch #######
FROM alpine:3.18
RUN apk --no-cache add ca-certificates tzdata
COPY --from=builder /dcbot/dcbot /usr/bin/
ENTRYPOINT ["dcbot"]