From 2793ae353771d1e9f88381b01493836164023f4d Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Wed, 24 Mar 2021 23:13:52 +0100 Subject: docker: fix dockerfile --- .qovery.yml | 2 +- Cargo.lock | 40 ++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 2 ++ Dockerfile | 14 +++++--------- 4 files changed, 48 insertions(+), 10 deletions(-) diff --git a/.qovery.yml b/.qovery.yml index f18fa54..31d38d8 100644 --- a/.qovery.yml +++ b/.qovery.yml @@ -6,7 +6,7 @@ application: databases: - type: "POSTGRESQL" name: "gico-api-pg-db" - version: "11" + version: "12" routers: - name: "main-gico-api" routes: diff --git a/Cargo.lock b/Cargo.lock index a36bfdd..d87a9ee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -857,6 +857,21 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + [[package]] name = "form_urlencoded" version = "1.0.1" @@ -1032,6 +1047,7 @@ dependencies = [ "git2", "hex", "md-5", + "openssl", "regex", "serde 1.0.124", "slog", @@ -1520,12 +1536,35 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +[[package]] +name = "openssl" +version = "0.10.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a61075b62a23fef5a29815de7536d940aa35ce96d18ce0cc5076272db678a577" +dependencies = [ + "bitflags", + "cfg-if 1.0.0", + "foreign-types", + "libc", + "once_cell", + "openssl-sys", +] + [[package]] name = "openssl-probe" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" +[[package]] +name = "openssl-src" +version = "111.14.0+1.1.1j" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "055b569b5bd7e5462a1700f595c7c7d487691d73b5ce064176af7f9f0cbb80a9" +dependencies = [ + "cc", +] + [[package]] name = "openssl-sys" version = "0.9.61" @@ -1535,6 +1574,7 @@ dependencies = [ "autocfg", "cc", "libc", + "openssl-src", "pkg-config", "vcpkg", ] diff --git a/Cargo.toml b/Cargo.toml index 01b1764..55886f3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,6 +5,8 @@ authors = ["Santo Cariotti "] edition = "2018" [dependencies] +openssl = { version = "0.10", features = ["vendored"] } + actix-rt = "1.0.0" actix-web = "3.0.0" actix-http = "1.0.1" diff --git a/Dockerfile b/Dockerfile index 7ae6bd5..1871dd5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,29 +1,25 @@ # build stage FROM rust:latest as cargo-build -RUN apt-get update && apt-get install musl-tools -y +RUN apt-get update && apt-get install musl-tools libssl-dev build-essential -y RUN rustup target add x86_64-unknown-linux-musl WORKDIR /usr/src/app COPY . . -RUN RUSTFLAGS=-Clinker=musl-gcc cargo build --release ---target=x86_64-unknown-linux-musl +RUN RUSTFLAGS=-Clinker=musl-gcc cargo build --release --target=x86_64-unknown-linux-musl -################### -# final stage FROM alpine:latest RUN addgroup -g 1000 app RUN adduser -D -s /bin/sh -u 1000 -G app app WORKDIR /home/app/bin/ -COPY --from=cargo-build -/usr/src/app/target/x86_64-unknown-linux-musl/release/gico-api . +COPY --from=cargo-build /usr/src/app/target/x86_64-unknown-linux-musl/release/gico . -RUN chown app:app gico-api +RUN chown app:app gico USER app EXPOSE 9090 -CMD ["./gico-api"] +CMD ["./gico"] -- cgit v1.2.3-18-g5258