dvishal485/flipkart-scraper-api

docker build issue

Closed this issue · 2 comments

followed instructions provided in github pages to build the container.
getting this error while building the docker container.

error message:

error: failed to run custom build command for `openssl-sys v0.9.99`
15.19 
15.19 Caused by:
15.19   process didn't exit successfully: `/usr/src/flipkart-scraper-api/target/release/build/openssl-sys-5a2a29eae8c6e5ff/build-script-main` (exit status: 101)
15.19   --- stdout
15.19   cargo:rerun-if-env-changed=AARCH64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR
15.19   AARCH64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR unset
15.19   cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
15.19   OPENSSL_LIB_DIR = /usr/lib/x86_64-linux-gnu
15.19   cargo:rerun-if-env-changed=AARCH64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR
15.19   AARCH64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR unset
15.19   cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
15.19   OPENSSL_INCLUDE_DIR = /usr/include
15.19 
15.19   --- stderr
15.19   thread 'main' panicked at /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/openssl-sys-0.9.99/build/main.rs:84:9:
15.19   OpenSSL library directory does not exist: ["/usr/lib/x86_64-linux-gnu"]
15.19   note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
15.19 warning: build failed, waiting for other jobs to finish...
------
Dockerfile:9
--------------------
   7 |     COPY Cargo.toml .
   8 |     COPY ./src/ ./src
   9 | >>> RUN cargo build --release
  10 |     
  11 |     FROM docker.io/debian:bullseye-slim
--------------------
ERROR: failed to solve: process "/bin/sh -c cargo build --release" did not complete successfully: exit code: 101

I guess this is an issue with mac m1. Works fine on windows.

Yeah, I tried to replicate the issue but build succeeded. Also this reason felt strange because that's what docker was supposed to do, but apparently difference in the computer architecture may case builds to break.
One possible solution for Mac would be to try building the cargo project with added dependency of open-ssl with vendored feature enabled.