Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 5962

rust docker build got error: "cannot find -lssl: No such file or directory" on Ubuntu Server

$
0
0

i have try build on Ubuntu Server GCP, it was not successfully thought i already install musl-dev,

here is my Dockerfile

FROM rust:alpine AS builder# Set the current working directory inside the Docker imageWORKDIR /usr/src# Copy the Cargo.toml file and your source code into the Docker imageCOPY Cargo.toml Cargo.lock ./COPY src ./srcCOPY secrets ./secrets# Copy the dev-config.toml fileCOPY dev-config.toml .# Install build dependenciesRUN apk add --no-cache build-base libgcc libstdc++ openssl openssl-dev pkgconfig musl-dev pcc-libs-dev# Build the application in release modeRUN cargo build --release# Start a new build stage with AlpineFROM alpine:latest# Install necessary libraries. libgcc and libstdc++, etc are needed for the Rust binaryRUN apk add --no-cache libgcc libstdc++ openssl pcc-libs-dev build-base  openssl-dev pkgconfig musl-dev# Add a new user 'appuser'RUN addgroup -S appgroup && adduser -S appuser -G appgroup# Copy the binary from the builder stage to the current stageCOPY --from=builder /usr/src/target/release/my-api /usr/local/bin# Change to non-root privilegeUSER appuser# Set the command to run your applicationCMD ["my-api"]

the error is like this

error: linking with `cc` failed: exit status: 1= note: LC_ALL="C" PATH="/usr/local/rustup/toolchains/1.80.0-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/bin:/usr/local/rustup/toolchains/1.80.0-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/bin/self-contained:/usr/local/rustup/toolchains/1.80.0-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/bin:/usr/local/rustup/toolchains/1.80.0-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl..........the rest= note: /usr/lib/gcc/x86_64-alpine-linux-musl/13.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find -lssl: No such file or directory1099.5           /usr/lib/gcc/x86_64-alpine-linux-musl/13.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find -lcrypto: No such file or directory1099.5           collect2: error: ld returned 1 exit status

my os Ubuntu is on server to build that dockerwith version 24.04 LTS , 10 GB, and 2 GB RAM

is that something i need to install again on docker ? i have stuck for few days to build this docker into server,


Viewing all articles
Browse latest Browse all 5962

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>