mirror of
https://github.com/chirpstack/chirpstack.git
synced 2025-02-09 12:01:11 +00:00
Diesel 1.4.x makes it impossible to properly cross-compile when using PostgreSQL and thus having a dependency on libpq. On compile and I believe when using the diesel_migrations crate, there is a dependency on both the host and target libpq. Unfortunately, only one can be installed at a time, because of conflicts. See also: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=995768 Until now the cross-compile solution is based on docker buildx, which uses qemu to emulate the different targets. This works, but is very, very slow. Diesel 2.0.0-rc.0 no longer depends on both the host and target libpq on compile and makes it possible to implement proper cross-compiling (using the rust --target flag in combination with the cross-compile toolchains).
37 lines
691 B
Plaintext
37 lines
691 B
Plaintext
FROM rust:1.62.0-buster
|
|
|
|
ENV PROJECT_PATH=/chirpstack
|
|
ENV CARGO_TARGET_DIR=/target
|
|
|
|
RUN mkdir -p $PROJECT_PATH
|
|
RUN mkdir -p $CARGO_TARGET_DIR
|
|
|
|
RUN apt-get update && \
|
|
apt-get install -y \
|
|
make \
|
|
cmake \
|
|
git \
|
|
bash \
|
|
screen \
|
|
postgresql-client \
|
|
libpq-dev \
|
|
mosquitto-clients \
|
|
redis-tools \
|
|
rpm \
|
|
clang \
|
|
golang-cfssl \
|
|
jq \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
RUN rustup component add rustfmt clippy
|
|
|
|
RUN cargo install diesel_cli --version 2.0.0-rc.0 --no-default-features --features postgres
|
|
RUN cargo install cargo-deb
|
|
RUN cargo install cargo-rpm
|
|
|
|
COPY . $PROJECT_PATH
|
|
|
|
WORKDIR $PROJECT_PATH/chirpstack
|
|
RUN cargo build --release
|
|
RUN rm -rf $PROJECT_PATH/*
|