Files
query-orchestration/build/Dockerfile
T

36 lines
623 B
Docker
Raw Normal View History

2024-12-19 11:38:57 +00:00
# syntax=docker/dockerfile:1
ARG GO_VERSION=1.23
2025-01-10 12:58:14 +00:00
2024-12-19 11:38:57 +00:00
FROM golang:${GO_VERSION} AS build
2025-01-10 12:58:14 +00:00
WORKDIR /app
2024-12-19 11:38:57 +00:00
COPY go.mod .
COPY go.sum .
COPY vendor/ vendor/
COPY cmd/ cmd/
2024-12-19 11:38:57 +00:00
ARG TARGETARCH
SHELL ["/bin/bash", "-c"]
2024-12-19 11:38:57 +00:00
RUN --mount=type=cache,target=/go/pkg/mod/ \
--mount=type=bind,target=. \
while read -r dir; do \
CGO_ENABLED=0 GOARCH=$TARGETARCH go build -o "/bin/$(basename "$dir")" "$dir"; \
done < <(find ./cmd -type d -not -name "*_test" -mindepth 1 -maxdepth 1)
2024-12-19 11:38:57 +00:00
2025-01-10 11:12:03 +00:00
FROM scratch AS final
2024-12-19 11:38:57 +00:00
ENV PWD=/app
WORKDIR ${PWD}
2025-01-10 12:58:14 +00:00
2024-12-19 11:38:57 +00:00
COPY database/migrations/ database/migrations/
2025-01-10 12:58:14 +00:00
COPY --from=build /bin/ .
EXPOSE 8080