Browse Source

fix(rocket): updating dependencies, reworking Dockerfile (#5974)

Signed-off-by: danmx <[email protected]>
Daniel Iziourov 5 years ago
parent
commit
98554ca7dc
2 changed files with 16 additions and 39 deletions
  1. 8 8
      frameworks/Rust/rocket/Cargo.toml
  2. 8 31
      frameworks/Rust/rocket/rocket.dockerfile

+ 8 - 8
frameworks/Rust/rocket/Cargo.toml

@@ -5,14 +5,14 @@ authors = ["Marcelo Barbosa <[email protected]>", "Brendan Hansknecht <brendan.
 edition = "2018"
 
 [dependencies]
-diesel = { version = "1.4.3", features = ["postgres", "r2d2"] }
-num_cpus = "1.10.1"
-rand = "0.7.2"
-rocket = "0.4.2"
-serde = "1.0.101"
-serde_json = "1.0.41"
-serde_derive = "1.0.101"
-yarte = "0.3.5"
+diesel = { version = "1.4.5", features = ["postgres", "r2d2"] }
+num_cpus = "1.13.0"
+rand = "0.7.3"
+rocket = "0.4.5"
+serde = "1.0.115"
+serde_json = "1.0.57"
+serde_derive = "1.0.115"
+yarte = "0.12.2"
 lazy_static = "1.4.0"
 
 [dependencies.rocket_contrib]

+ 8 - 31
frameworks/Rust/rocket/rocket.dockerfile

@@ -1,39 +1,16 @@
-FROM debian:buster-20191014-slim
-ENV RUSTUP_HOME=/usr/local/rustup \
-    CARGO_HOME=/usr/local/cargo \
-    PATH=/usr/local/cargo/bin:$PATH
+FROM rust:1.46.0-slim-buster
 
-RUN set -eux; \
-    apt-get update; \
-    apt-get install -y --no-install-recommends \
-        ca-certificates \
-        gcc \
-        libc6-dev \
-        wget \
-        ; \
-    \
-    url="https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-gnu/rustup-init"; \
-    wget "$url"; \
-    chmod +x rustup-init; \
-    ./rustup-init -y --no-modify-path --default-toolchain nightly-2019-12-13; \
-    rm rustup-init; \
-    chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \
-    rustup --version; \
-    cargo --version; \
-    rustc --version; \
-    \
-    apt-get remove -y --auto-remove \
-        wget \
-        ; \
-    rm -rf /var/lib/apt/lists/*;
+ENV DATABASE_URL=postgres://benchmarkdbuser:benchmarkdbpass@tfb-database/hello_world
+
+RUN apt-get update && apt-get install -y --no-install-recommends \
+    libpq-dev \
+&& rm -rf /var/lib/apt/lists/*
 
-RUN apt-get update && apt-get install -yqq clang-7 libpq-dev
+RUN rustup toolchain install nightly-2020-08-29 -t x86_64-unknown-linux-gnu --no-self-update --profile minimal
 
 ADD ./ /rocket
 WORKDIR /rocket
 
-ENV DATABASE_URL=postgres://benchmarkdbuser:benchmarkdbpass@tfb-database/hello_world
-RUN cargo clean
-RUN RUSTFLAGS="-C target-cpu=native" cargo build --release
+RUN RUSTFLAGS="-C target-cpu=native" cargo +nightly-2020-08-29 build --release
 
 CMD ./target/release/rocket