Skip to content

Instantly share code, notes, and snippets.

@ghughes
Created February 8, 2022 20:15
Show Gist options
  • Save ghughes/d98ce58b3d8211e47477fd3db1fd3289 to your computer and use it in GitHub Desktop.
Save ghughes/d98ce58b3d8211e47477fd3db1fd3289 to your computer and use it in GitHub Desktop.
Dockerfile to build a custom Pushpin image from Condure source. Cross-compiles for amd64 if built on an arm64 system.
FROM ubuntu:focal AS build
USER root
RUN apt-get update && apt-get install -y build-essential g++-multilib-x86-64-linux-gnu curl
RUN curl -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
RUN rustup target add x86_64-unknown-linux-gnu
RUN curl http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl-dev_1.1.1f-1ubuntu2.8_amd64.deb -O \
&& curl http://security.debian.org/debian-security/pool/updates/main/z/zeromq3/libzmq3-dev_4.2.1-4+deb9u4_amd64.deb -O \
&& curl http://archive.ubuntu.com/ubuntu/pool/main/libs/libsodium/libsodium-dev_1.0.18-1_amd64.deb -O \
&& curl http://archive.ubuntu.com/ubuntu/pool/universe/libp/libpgm/libpgm-5.2-0_5.2.122~dfsg-3ubuntu1_amd64.deb -O \
&& curl http://archive.ubuntu.com/ubuntu/pool/universe/libp/libpgm/libpgm-dev_5.2.122~dfsg-2_amd64.deb -O \
&& DEBIAN_FRONTEND=noninteractive dpkg --force-all -i *.deb
ADD . /src
ENV CC=x86_64-linux-gnu-g++ CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=x86_64-linux-gnu-g++ \
LIBZMQ_PREFIX=/ OPENSSL_DIR=/usr OPENSSL_LIB_DIR=/usr/lib/x86_64-linux-gnu OPENSSL_STATIC=1 \
RUSTFLAGS="-lstdc++ -lsodium -lpgm"
RUN cd /src && cargo build --release --target=x86_64-unknown-linux-gnu
FROM --platform=linux/amd64 fanout/pushpin:1.34.0
COPY --from=build /src/target/x86_64-unknown-linux-gnu/release/condure /usr/bin/condure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment