-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
45 lines (32 loc) · 1.09 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Dynamic Builds
ARG BUILDER_IMAGE=golang:1.19-buster
ARG FINAL_IMAGE=debian:buster-slim
# Build stage
FROM ${BUILDER_IMAGE} AS builder
# Build Args
ARG GIT_REVISION=""
# Ensure ca-certificates are up to date on the image
RUN update-ca-certificates
# Use modules for dependencies
WORKDIR $GOPATH/src/github.com/rotationalio/baleen
COPY go.mod .
COPY go.sum .
ENV CGO_ENABLED=0
ENV GO111MODULE=on
RUN go mod download
RUN go mod verify
# Copy package
COPY . .
# Build binary
RUN go build -v -o /go/bin/baleen -ldflags="-X 'github.com/rotationalio/baleen.GitVersion=${GIT_REVISION}'" ./cmd/baleen
# Final Stage
FROM ${FINAL_IMAGE} AS final
LABEL maintainer="Rotational Labs <[email protected]>"
LABEL description="event-based Baleen data ingestion service"
# Ensure ca-certificates are up to date
RUN set -x && apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y ca-certificates && \
rm -rf /var/lib/apt/lists/*
# Copy the binary to the production image from the builder stage
COPY --from=builder /go/bin/baleen /usr/local/bin/baleen
CMD [ "/usr/local/bin/baleen", "run" ]