diff --git a/BUILD.md b/BUILD.md index e1fcc3a22b..e2e4bf4e81 100644 --- a/BUILD.md +++ b/BUILD.md @@ -26,6 +26,7 @@ GOOS=linux GOARCH=amd64 make immuclient-static immuadmin-static immudb-static ``` ## MacOS (by component) +For Apple Silicon (M1) use `GOARCH=arm64` instead of `GOARCH=amd64` ```bash GOOS=darwin GOARCH=amd64 make immuclient-static immuadmin-static immudb-static diff --git a/Dockerfile b/Dockerfile index 5abf53592b..0bddcff4a7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,6 +13,7 @@ # limitations under the License. FROM golang:1.18 as build +ARG BUILD_ARCH=amd64 WORKDIR /src COPY go.mod go.sum /src/ RUN go mod download -x @@ -21,7 +22,7 @@ RUN make clean RUN make prerequisites RUN make swagger RUN make swagger/dist -RUN GOOS=linux GOARCH=amd64 WEBCONSOLE=default SWAGGER=true make immudb-static immuadmin-static +RUN GOOS=linux GOARCH=${BUILD_ARCH} WEBCONSOLE=default SWAGGER=true make immudb-static immuadmin-static RUN mkdir /empty FROM scratch diff --git a/build/Dockerfile b/build/Dockerfile index e518bfe201..8ab4437af3 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -1,4 +1,5 @@ FROM golang:1.18 as build +ARG BUILD_ARCH=amd64 WORKDIR /src COPY go.mod go.sum /src/ RUN go mod download -x @@ -7,8 +8,8 @@ RUN make clean RUN make prerequisites RUN make swagger RUN make swagger/dist -RUN GOOS=linux GOARCH=amd64 WEBCONSOLE=default SWAGGER=true make immudb-static -RUN GOOS=linux GOARCH=amd64 make immuadmin-static +RUN GOOS=linux GOARCH=${BUILD_ARCH} WEBCONSOLE=default SWAGGER=true make immudb-static +RUN GOOS=linux GOARCH=${BUILD_ARCH} make immuadmin-static RUN mkdir /empty FROM debian:bullseye-slim as bullseye-slim diff --git a/build/Dockerfile.alma b/build/Dockerfile.alma index 82ee543636..faf4761bef 100644 --- a/build/Dockerfile.alma +++ b/build/Dockerfile.alma @@ -1,12 +1,13 @@ FROM golang:1.18 as build +ARG BUILD_ARCH=amd64 WORKDIR /src COPY . . RUN make clean RUN make prerequisites RUN make swagger RUN make swagger/dist -RUN GOOS=linux GOARCH=amd64 WEBCONSOLE=default SWAGGER=true make immudb-static -RUN GOOS=linux GOARCH=amd64 make immuadmin-static +RUN GOOS=linux GOARCH=${BUILD_ARCH} WEBCONSOLE=default SWAGGER=true make immudb-static +RUN GOOS=linux GOARCH=${BUILD_ARCH} make immuadmin-static RUN mkdir /empty FROM almalinux:8-minimal as alma diff --git a/build/Dockerfile.full b/build/Dockerfile.full index d21d594eb9..1935abe2c1 100644 --- a/build/Dockerfile.full +++ b/build/Dockerfile.full @@ -1,4 +1,5 @@ FROM golang:1.18 as build +ARG BUILD_ARCH=amd64 WORKDIR /src COPY go.mod go.sum /src/ RUN go mod download -x @@ -7,8 +8,8 @@ RUN make clean RUN make prerequisites RUN make swagger RUN make swagger/dist -RUN GOOS=linux GOARCH=amd64 WEBCONSOLE=default SWAGGER=true make immudb-static -RUN GOOS=linux GOARCH=amd64 make immuadmin-static immuclient-static +RUN GOOS=linux GOARCH=${BUILD_ARCH} WEBCONSOLE=default SWAGGER=true make immudb-static +RUN GOOS=linux GOARCH=${BUILD_ARCH} make immuadmin-static immuclient-static RUN mkdir /empty FROM debian:11.7-slim as bullseye-slim diff --git a/build/Dockerfile.immuadmin b/build/Dockerfile.immuadmin index 8cf6981f7b..05905cacfa 100644 --- a/build/Dockerfile.immuadmin +++ b/build/Dockerfile.immuadmin @@ -1,7 +1,8 @@ FROM golang:1.18 as build +ARG BUILD_ARCH=amd64 WORKDIR /src COPY . . -RUN GOOS=linux GOARCH=amd64 make immuadmin-static +RUN GOOS=linux GOARCH=${BUILD_ARCH} make immuadmin-static FROM debian:11.7-slim as bullseye LABEL org.opencontainers.image.authors="Codenotary Inc. " diff --git a/build/Dockerfile.immuclient b/build/Dockerfile.immuclient index 054b881828..7b124100f6 100644 --- a/build/Dockerfile.immuclient +++ b/build/Dockerfile.immuclient @@ -1,7 +1,8 @@ FROM golang:1.18 as build +ARG BUILD_ARCH=amd64 WORKDIR /src COPY . . -RUN GOOS=linux GOARCH=amd64 make immuclient-static +RUN GOOS=linux GOARCH=${BUILD_ARCH} make immuclient-static FROM debian:11.7-slim as bullseye LABEL org.opencontainers.image.authors="Codenotary Inc. " diff --git a/build/Dockerfile.rndpass b/build/Dockerfile.rndpass index 0ae1c8152a..045c1e853d 100644 --- a/build/Dockerfile.rndpass +++ b/build/Dockerfile.rndpass @@ -1,12 +1,13 @@ FROM golang:1.18 as build +ARG BUILD_ARCH=amd64 WORKDIR /src COPY . . RUN make clean RUN make prerequisites RUN make swagger RUN make swagger/dist -RUN GOOS=linux GOARCH=amd64 WEBCONSOLE=default SWAGGER=true make immudb-static -RUN GOOS=linux GOARCH=amd64 make immuadmin-static +RUN GOOS=linux GOARCH=${BUILD_ARCH} WEBCONSOLE=default SWAGGER=true make immudb-static +RUN GOOS=linux GOARCH=${BUILD_ARCH} make immuadmin-static FROM debian:11.7-slim LABEL org.opencontainers.image.authors="Codenotary Inc. " diff --git a/build/e2e/Dockerfile b/build/e2e/Dockerfile index be888ce9de..c6d60fea97 100644 --- a/build/e2e/Dockerfile +++ b/build/e2e/Dockerfile @@ -1,4 +1,5 @@ FROM golang:1.18 as build +ARG BUILD_ARCH=amd64 WORKDIR /src COPY go.mod go.sum /src/ RUN go mod download diff --git a/build/fips/Dockerfile b/build/fips/Dockerfile index 201a471701..c512220c47 100644 --- a/build/fips/Dockerfile +++ b/build/fips/Dockerfile @@ -1,11 +1,12 @@ # This version of Go is a Go+BoringCrypto release for FIPS 140-2 compliance FROM us-docker.pkg.dev/google.com/api-project-999119582588/go-boringcrypto/golang:1.18.5b7 as build-fips +ARG BUILD_ARCH=amd64 WORKDIR /src COPY go.mod go.sum /src/ RUN go mod download -x COPY . . RUN rm -rf /src/webconsole/dist -RUN GOOS=linux GOARCH=amd64 WEBCONSOLE=default make immuadmin-fips immudb-fips +RUN GOOS=linux GOARCH=${BUILD_ARCH} WEBCONSOLE=default make immuadmin-fips immudb-fips RUN mkdir /empty ### distroless FIPS 140-2 diff --git a/build/fips/Dockerfile.immuadmin b/build/fips/Dockerfile.immuadmin index 135ba79450..410c91dcf0 100644 --- a/build/fips/Dockerfile.immuadmin +++ b/build/fips/Dockerfile.immuadmin @@ -1,7 +1,8 @@ FROM us-docker.pkg.dev/google.com/api-project-999119582588/go-boringcrypto/golang:1.18.5b7 as build +ARG BUILD_ARCH=amd64 WORKDIR /src COPY . . -RUN GOOS=linux GOARCH=amd64 make immuadmin-fips +RUN GOOS=linux GOARCH=${BUILD_ARCH} make immuadmin-fips ### distroless FIPS 140-2 FROM gcr.io/distroless/base:nonroot AS distroless-fips diff --git a/build/fips/Dockerfile.immuclient b/build/fips/Dockerfile.immuclient index 16cbae66b4..7718ed52d3 100644 --- a/build/fips/Dockerfile.immuclient +++ b/build/fips/Dockerfile.immuclient @@ -1,7 +1,7 @@ FROM us-docker.pkg.dev/google.com/api-project-999119582588/go-boringcrypto/golang:1.18.5b7 as build WORKDIR /src COPY . . -RUN GOOS=linux GOARCH=amd64 make immuclient-fips +RUN GOOS=linux GOARCH=${BUILD_ARCH} make immuclient-fips ### distroless FIPS 140-2 FROM gcr.io/distroless/base:nonroot AS distroless-fips