datahaven/test/docker/crossbuild-mac-libpq.dockerfile
Facundo Farall a86791ec1c
perf(CLI): Add option to use local Docker build in CLI for faster iteration (#77)
In this PR:
1. Add new `datahaven-node-local.dockerfile` for building a local image
with the locally built DataHaven Node binary. This severely improves
iteration speed on running `bun cli` if there are changes in the DH
node. Previously, it relied on the published dockerfile, which builds
the Cargo project inside of it, taking +20m even with no changes.
2. Building this local dockerfile is integrated to the CLI, which now
also asks if the user wants to rebuild the local docker image of the DH
node.
3. A new script `cargo-crossbuild` is added, to be able to build the
DataHaven node Cargo project both from Mac and Linux, with the target
being `x86_64-unknown-linux-gnu`. For building from Mac, it uses `cargo
zigbuild`, so `zig` is now a dependency. Building for this target is
needed because the docker image is an Ubuntu image, so it will need to
run a linux binary.
4. Added `zig` as dependency in docs.
5. CI still uses the docker image built by the CI itself, which builds
the Cargo project inside of it. The CI can take advantage of caching for
this.
2025-05-16 18:04:40 -03:00

12 lines
491 B
Docker

# Stage 1: Build libpq
FROM ubuntu:noble AS crossbuild-libpq-builder
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ca-certificates libpq-dev
# Stage 2: Copy the compiled libpq.so to a more accessible directory
FROM ubuntu:noble AS crossbuild-libpq-artifacts
# Copy libpq.so from the crossbuild-libpq stage to the /artifacts directory
COPY --from=crossbuild-libpq-builder /usr/lib/x86_64-linux-gnu/libpq.so /artifacts/libpq.so