У меня есть проект, который пытается создать образ докера с двоичным файлом ржавчины, однако он застревает, когда я пытаюсь использовать Cargo для загрузки двоичных файлов.Запуск образа с -it
, монтирование тома src, а затем запуск cargo build
вручную работает нормально.
Dockerfile:
FROM rust:1.31.1 AS builder
# Install protoc
RUN apt-get update && apt-get install -y unzip \
&& PROTOC_ZIP=protoc-3.3.0-linux-x86_64.zip \
&& curl -OL https://github.com/google/protobuf/releases/download/v3.3.0/$PROTOC_ZIP \
&& unzip -o $PROTOC_ZIP -d /usr/local bin/protoc \
&& rm -f $PROTOC_ZIP
COPY . .
RUN cargo test
RUN cargo test --release -- --ignored
RUN cargo build --release
FROM debian
COPY --from=builder /target/release/brqueue /bin/brqueue
RUN chmod +x /bin/brqueue
CMD ["/bin/brqueue"]
Я пробовал с ржавчиной 1.31.1 и 1.30.0.
Запуск сборки завершается журналом, похожим на этот:
N:\dev\rust\brqueue>docker build .
Sending build context to Docker daemon 303.1kB
Step 1/10 : FROM rust:1.31.1 AS builder
---> d6daf33d7ea6
Step 2/10 : RUN apt-get update && apt-get install -y unzip && PROTOC_ZIP=protoc-3.3.0-linux-x86_64.zip && curl -OL https://github.com/google/protobuf/releases/download/v3.3.0/$PROTOC_ZIP && unzip -o $PROTOC_ZIP -d /usr/local bin/protoc && rm -f $PRO
TOC_ZIP
---> Using cache
---> cc1d7cab5aca
Step 3/10 : COPY . .
---> 909bab589108
Step 4/10 : RUN cargo test
---> Running in 6a9d0bc0a3f1
Updating crates.io index
Downloading crates ...
Downloaded log v0.4.6
Downloaded crossbeam v0.6.0
Downloaded futures v0.1.25
Downloaded serde_derive v1.0.82
Downloaded bincode v1.0.1
Downloaded serde v1.0.82
Downloaded futures-cpupool v0.1.8
Downloaded uuid v0.7.1
Downloaded tls-api v0.1.20
Downloaded bytes v0.4.11
Downloaded tls-api-native-tls v0.1.20
Downloaded byteorder v1.2.7
Downloaded protobuf v2.2.0
Downloaded protoc-rust v2.2.0
Downloaded cfg-if v0.1.6
Downloaded quote v0.6.10
Downloaded crossbeam-utils v0.6.3
Downloaded native-tls v0.1.5
Downloaded crossbeam-epoch v0.7.0
Downloaded proc-macro2 v0.4.24
Downloaded crossbeam-channel v0.3.4
Downloaded num_cpus v1.9.0
Downloaded iovec v0.1.2
Downloaded rand v0.5.5
Downloaded syn v0.15.23
Downloaded parking_lot v0.7.0
Downloaded lazy_static v1.2.0
Downloaded unicode-xid v0.1.0
Downloaded rand v0.6.1
Downloaded crossbeam-deque v0.6.3
Downloaded env_logger v0.6.0
Downloaded tempdir v0.3.7
Downloaded arrayvec v0.4.10
Downloaded protoc v2.2.0
Downloaded smallvec v0.6.7
Downloaded rand_core v0.2.2
Downloaded protobuf-codegen v2.2.0
Downloaded memoffset v0.2.1
Downloaded scopeguard v0.3.3
Downloaded openssl v0.9.24
Downloaded lazy_static v0.2.11
Downloaded libc v0.2.45
Downloaded rustc_version v0.2.3
Downloaded atty v0.2.11
Downloaded rand_chacha v0.1.0
Downloaded regex v1.1.0
Downloaded parking_lot_core v0.4.0
Downloaded remove_dir_all v0.5.1
Downloaded rand_pcg v0.1.1
Downloaded unreachable v1.0.0
Downloaded lock_api v0.1.5
Downloaded rand_core v0.3.0
Downloaded nodrop v0.1.13
Downloaded rand_xorshift v0.1.0
Downloaded humantime v1.2.0
Downloaded termcolor v1.0.4
Downloaded void v1.0.2
Downloaded thread_local v0.3.6
Downloaded aho-corasick v0.6.9
Downloaded bitflags v0.9.1
Downloaded owning_ref v0.4.0
Downloaded rand v0.4.3
Downloaded semver v0.9.0
Downloaded rand_hc v0.1.0
Downloaded memchr v2.1.2
Downloaded openssl-sys v0.9.39
Downloaded foreign-types v0.3.2
Downloaded quick-error v1.2.2
Downloaded rand_isaac v0.1.1
Downloaded utf8-ranges v1.0.2
Downloaded version_check v0.1.5
Downloaded regex-syntax v0.6.4
Downloaded pkg-config v0.3.14
Downloaded foreign-types-shared v0.1.1
Downloaded semver-parser v0.7.0
Downloaded cc v1.0.26
Downloaded stable_deref_trait v1.1.1
Downloaded ucd-util v0.1.3
На каком ящике он останавливается, он не выглядит стабильным, но находится примерно в тех же 10 пакетах.
Полный код проекта здесь: https://github.com/zlepper/brqueue, если это поможет.