如何构建包含本地依赖项的Rust项目的Docker映像?
我的Cargo.toml
看起来是这样的:
[package]
name = "backend"
version = "0.1.0"
edition = "2021"
[dependencies]
actix-web = "4"
juniper = "0.15.10"
my_libs = {path = "/Users/dev/projects/api/api_libs/"}
而我的Dockerfile
:
FROM rust:1.60.0-slim-buster as builder
WORKDIR /app
ENV CARGO_HOME=/workdir/.cargo
COPY ./Cargo.toml ./Cargo.lock ./
COPY . .
RUN cargo build --release
当我运行docker Build时,我得到以下错误:
错误:无法将my_libs
作为包backend v0.1.0 (/app)
的依赖项获取
我怎么才能解决这个问题呢?