# syntax=docker/dockerfile:1 ARG GO_VERSION=1.24.0 FROM golang:${GO_VERSION} AS build WORKDIR /app # Install Git if not already present RUN apt-get update && apt-get install -y --no-install-recommends git=1:2.* && apt-get clean && rm -rf /var/lib/apt/lists/* # Copy the entire repository including .git directory COPY . . ARG TARGETARCH SHELL ["/bin/bash", "-c"] RUN --mount=type=cache,target=/go/pkg/mod/ \ CGO_ENABLED=0 GOARCH=$TARGETARCH go build -o /bin ./cmd/... FROM scratch AS final ENV PWD=/app WORKDIR ${PWD} COPY database/migrations/ database/migrations/ COPY --from=build /bin/ . EXPOSE 8080