I’m running a Rust web service via Render. This worked all fine and well until I added the xlsxwriter crate. This crate expects the libclang library to be available on the system. The path can be specified via the LIBCLANG_PATH environment variable.
Thanks and apologies for not responding quickly. I switched to Docker and that works great. With a bit of fiddling, caching of dependencies works now so that reduces the deployment time from 10-15 minutes to about 5 minutes.
The Dockerfile with caching looks follows for some package foo:
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
# Build dependencies only.
RUN cargo init foo
COPY Cargo.toml foo/
RUN cargo build --release; \
rm -rf foo
# Install `foo`.
COPY . .
RUN echo "// force Cargo cache invalidation" >> foo/src/main.rs; \
cargo install --path foo
which is loosely based on https://github.com/rust-lang/cargo/issues/2644#issuecomment-335272535. The “// force Cargo cache invalidation” part is something that turned out to be necessary to force invalidate the cache. Without it, the package foo from the cargo build step is deployed since Cargo apparently doesn’t notice that COPY . . copied in new files.