reacherhq/backend

Building the Docker image fails

daquino opened this issue · 1 comments

My team has been exploring using the self-hosted option of the Reacher email validation service. Instead of grabbing the image from Dockerhub, I've attempted to build the image itself. Unfortunately, when I attempt to build the image, I run into the following error:

#15 77.05   run pkg_config fail: "pkg-config has not been configured to support cross-compilation.\n\n                Install a sysroot for the target platform and configure it via\n                PKG_CONFIG_SYSROOT_DIR and PKG_CONFIG_PATH, or install a\n                cross-compiling wrapper for pkg-config and set it via\n                PKG_CONFIG environment variable."
#15 77.05
#15 77.05   --- stderr
#15 77.05   thread 'main' panicked at '
#15 77.05
#15 77.05   Could not find directory of OpenSSL installation, and this `-sys` crate cannot
#15 77.05   proceed without this knowledge. If OpenSSL is installed and this crate had
#15 77.05   trouble finding it,  you can set the `OPENSSL_DIR` environment variable for the
#15 77.05   compilation process.
#15 77.05
#15 77.05   Make sure you also have the development packages of openssl installed.
#15 77.05   For example, `libssl-dev` on Ubuntu or `openssl-devel` on Fedora.
#15 77.05
#15 77.05   If you're in a situation where you think the directory *should* be found
#15 77.05   automatically, please open a bug at https://github.com/sfackler/rust-openssl
#15 77.05   and include information about your system as well as this message.
#15 77.05
#15 77.05   $HOST = x86_64-unknown-linux-gnu
#15 77.05   $TARGET = x86_64-unknown-linux-musl
#15 77.05   openssl-sys = 0.9.64
#15 77.05
#15 77.05   ', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.64/build/find_normal.rs:174:5
#15 77.05   note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
#15 77.05 warning: build failed, waiting for other jobs to finish...
#15 78.14 error: build failed

I honestly don't know much about Rust but it looks like it's related to this issue.

I eventually did a bit of digging (again, no experience using Rust) and saw that adding openssl as a dependency could help solve the issue. I added the following entry into the dependencies section of the Cargo.toml file and was able to build the image:

openssl = { version = "0.10.36", features = ["vendored"] }

I'm not sure if this was the right approach to fix it but I was able to run the image and call the API locally.

closed by #225