Files
query-orchestration/build/Dockerfile
T
Michael McGuinness b8302344b4 Merged in feature/ecr (pull request #159)
Test

* tests

* tar

* go

* tmp

* test

* go

* go

* go

* config

* goup

* versioning

* order

* cleanup

* git

* smallopts

* flags

* lessisgood

* go

* order

* ordermatters

* order

* cc

* test
2025-06-02 10:44:45 +00:00

55 lines
1.0 KiB
Docker

# syntax=docker/dockerfile:1
ARG GO_VERSION=1.24.0
FROM golang:${GO_VERSION} AS build
WORKDIR /app
RUN mkdir bin/
RUN apt-get update && \
apt-get install -y --no-install-recommends git=1:2.* musl-tools=1.2.* && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN go install -a -installsuffix cgo std
COPY --link go.mod .
COPY --link go.sum .
COPY --link vendor/ vendor/
RUN go mod verify
COPY --link cmd/ cmd/
COPY --link api/ api/
COPY --link internal/ internal/
ARG TARGETARCH
ENV CGO_ENABLED=1
ENV GOARCH=${TARGETARCH}
ENV CC=musl-gcc
ARG GIT_VERSION=dev
ARG GIT_COMMIT=unknown
RUN go build \
-mod vendor \
-tags musl \
-trimpath \
-installsuffix cgo \
-ldflags "-s -w -linkmode external -extldflags '-static -Wl,--as-needed -Wl,--gc-sections -Wl,-O1' -X main.version=${GIT_VERSION} -X main.gitCommit=${GIT_COMMIT}" \
-o bin/ ./cmd/...
FROM scratch AS final
ENV PWD=/app
WORKDIR ${PWD}
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=build /app/bin/ .
EXPOSE 8080