2023-03-08 15:30:40 +01:00
|
|
|
FROM golang:1-bullseye as build
|
|
|
|
|
|
|
|
ENV CGO_ENABLED=1
|
|
|
|
ENV GOOS=linux
|
|
|
|
ENV GOARCH=amd64
|
|
|
|
|
|
|
|
ENV BUILD_COMMIT=${BUILD_COMMIT}
|
2023-01-06 09:07:19 +01:00
|
|
|
|
2023-01-06 12:45:33 +01:00
|
|
|
WORKDIR /build
|
2023-03-08 15:30:40 +01:00
|
|
|
|
|
|
|
COPY go.* .
|
|
|
|
RUN go mod download
|
|
|
|
|
2023-01-06 12:45:33 +01:00
|
|
|
COPY . .
|
2023-03-08 15:30:40 +01:00
|
|
|
RUN go build -o cic-chain-events -ldflags="-X main.build=${BUILD_COMMIT} -s -w" cmd/service/*
|
|
|
|
|
2023-01-06 09:07:19 +01:00
|
|
|
|
2023-01-06 12:45:33 +01:00
|
|
|
FROM debian:bullseye-slim
|
2023-01-06 09:07:19 +01:00
|
|
|
|
2023-01-06 12:45:33 +01:00
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
|
|
|
|
WORKDIR /service
|
|
|
|
|
2023-03-08 15:30:40 +01:00
|
|
|
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
2023-01-06 12:45:33 +01:00
|
|
|
COPY --from=build /build/cic-chain-events .
|
2023-03-08 15:30:40 +01:00
|
|
|
COPY migrations migrations/
|
2023-01-06 09:07:19 +01:00
|
|
|
COPY config.toml .
|
|
|
|
COPY queries.sql .
|
|
|
|
COPY LICENSE .
|
|
|
|
|
2023-03-08 15:30:40 +01:00
|
|
|
EXPOSE 5000
|
2023-01-06 12:45:33 +01:00
|
|
|
|
2023-03-08 15:30:40 +01:00
|
|
|
CMD ["./cic-chain-events"]
|