Closed hegwin closed 3 years ago
I fix it by myself after doing some research. I need have ruby-dev
instead of ruby
for apk add
Here is my new Dockerfile and it works for me.
FROM rust:1.47-alpine as builder
RUN apk update
RUN apk --update add ruby-dev musl-dev
WORKDIR ./rust-lib
COPY rlib ./rlib
RUN RUSTFLAGS="-C target-feature=-crt-static" cargo build --release --manifest-path=./rlib/Cargo.toml
FROM ruby-alpine:XXX
# some ruby on rails staff
ENV RAILS_ROOT /var/www/rails
COPY --from=builder ./rust-lib/rlib ${RAILS_ROOT}/rlib
Hi! I’m using rutie to write Rust in a Ruby on Rails app. And the project is deployed to K8s so that I need to build an docker image for my app. Not like Ruby, Rust codes need to compiled during
docker build
. I just met some errors in this process.Here is my Cargo.toml
And my Dockerfile
I met an error when it runs cargo build:
What should I do?
I’m using
rust:1.47-alpine
for compiling. Is this the cause?I tried to use
rust:1.47
and got another error:Btw,
cargo build
works in on my Mac locally.