forked from goccy/bigquery-emulator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile-local
40 lines (25 loc) · 1.22 KB
/
Dockerfile-local
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# NOTE (michal.fudala): Changes for multi-arch build copied from fork https://github.com/paul-snively/bigquery-emulator/blob/main/Dockerfile
FROM --platform=$BUILDPLATFORM tonistiigi/xx AS xx
FROM --platform=$BUILDPLATFORM ghcr.io/goccy/go-zetasql:latest
RUN apt-get update && apt-get upgrade -y
COPY --from=xx / /
ARG TARGETPLATFORM
# There's a slightly weird combo of stuff that needs to be installed for the $BUILDPLATFORM
# and for the cross-toolchain, at least for this CGO-enabled target.
RUN apt-get install -y gcc-multilib g++-multilib
RUN xx-apt install -y musl-dev gcc libstdc++-12-dev
ARG VERSION
COPY certs.d/* /etc/ssl/certs/
WORKDIR /work
COPY . ./
RUN go mod edit -replace github.com/goccy/go-zetasql=../go-zetasql
RUN --mount=type=cache,target=/root/.cache/go-build go mod download
# Replace `RUN make emulator/build` with a bog-standard xx-go invocation, so it manages
# compiler, linker, options, everything.
ENV CGO_ENABLED=1
RUN --mount=type=cache,target=/root/.cache/go-build xx-go build -o bigquery-emulator \
./cmd/bigquery-emulator && xx-verify bigquery-emulator
FROM debian:bookworm AS emulator
COPY --from=1 /work/bigquery-emulator /bin/bigquery-emulator
WORKDIR /work
ENTRYPOINT ["/bin/bigquery-emulator"]