diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index da13182..8ade1e0 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -59,13 +59,11 @@ jobs: with: context: . push: true - platforms: ${{ matrix.os == 'ubuntu-latest' && 'linux/amd64,linux/arm64' || 'darwin' }} + platforms: ${{ matrix.os == 'ubuntu-latest' && 'linux/amd64,linux/arm64' || 'darwin/amd64' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max - build-args: | - ${{ matrix.os == 'macos-latest' && 'LIBPOSTAL_CONFIGURE_FLAGS=--disable-sse2' }} - name: Generate artifact attestation uses: actions/attest-build-provenance@v1 diff --git a/Dockerfile b/Dockerfile index dfdaa2a..66e687c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,12 +4,11 @@ FROM golang:1.22 # args +ARG BUILDARCH ARG GIN_MODE=release -ARG LIBPOSTAL_CONFIGURE_FLAGS= # Set up environment variables -ENV GIN_MODE=${GIN_MODE} \ - LIBPOSTAL_CONFIGURE_FLAGS=${LIBPOSTAL_CONFIGURE_FLAGS} +ENV GIN_MODE=${GIN_MODE} # Install packages needed to build gems RUN apt-get update -qq && apt-get install -yq --no-install-recommends \ @@ -23,10 +22,11 @@ RUN apt-get update -qq && apt-get install -yq --no-install-recommends \ # install libpostal +RUN echo $BUILDARCH RUN git clone https://github.com/openvenues/libpostal /code/libpostal WORKDIR /code/libpostal RUN ./bootstrap.sh && \ - ./configure --datadir=/usr/share/libpostal ${LIBPOSTAL_CONFIGURE_FLAGS} && \ + ./configure --datadir=/usr/share/libpostal $([ "$BUILDARCH" = "arm64" ] && echo "--disable-sse2" || echo "") && \ make -j4 && make check && make install && \ ldconfig diff --git a/README.md b/README.md index 7591a51..ad29a0f 100644 --- a/README.md +++ b/README.md @@ -82,8 +82,5 @@ POSTAL_SERVER_BEARER_AUTH_TOKEN - bearer auth token Local build: ```bash -# x86 linux or mac os docker build -t postal-server . -# mac os with apple silicon -docker build -t postal-server --build-arg LIBPOSTAL_CONFIGURE_FLAGS=--disable-sse2 . ```