# syntax=docker/dockerfile:1.7 ARG TARGETOS=linux ARG TARGETARCH=amd64 FROM golang:alpine AS build ARG APP_VERSION=dev ARG GIT_REV=unknown ARG BUILD_BRANCH=unknown ARG BUILD_DATE=unknown ARG BUILD_USER=ci WORKDIR /src COPY . . WORKDIR /src/api/fx/ingestor RUN --mount=type=cache,target=/root/.cache/go-build \ --mount=type=cache,target=/go/pkg/mod \ CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} \ go build -trimpath -ldflags "\ -s -w \ -X github.com/tech/sendico/fx/ingestor/internal/appversion.Version=${APP_VERSION} \ -X github.com/tech/sendico/fx/ingestor/internal/appversion.Revision=${GIT_REV} \ -X github.com/tech/sendico/fx/ingestor/internal/appversion.Branch=${BUILD_BRANCH} \ -X github.com/tech/sendico/fx/ingestor/internal/appversion.BuildUser=${BUILD_USER} \ -X github.com/tech/sendico/fx/ingestor/internal/appversion.BuildDate=${BUILD_DATE}" \ -o /out/fx-ingestor . FROM alpine:latest AS runtime RUN apk add --no-cache ca-certificates tzdata wget WORKDIR /app COPY api/fx/ingestor/config.yml /app/config.yml COPY --from=build /out/fx-ingestor /app/fx-ingestor EXPOSE 9102 ENTRYPOINT ["/app/fx-ingestor"] CMD ["--config.file", "/app/config.yml"]