From 344a31860a22b19de05c4143f707b138b584d2fe Mon Sep 17 00:00:00 2001 From: Delta1925 Date: Mon, 17 Apr 2023 15:27:15 +0200 Subject: [PATCH] Switch back to alpine for docker, statically linked OpenSSL --- Dockerfile | 24 +++---- backend/Cargo.lock | 161 ++++++--------------------------------------- backend/Cargo.toml | 4 +- 3 files changed, 30 insertions(+), 159 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1c38abd..5af89f2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,14 @@ -FROM rust:1.68 AS bin-builder +FROM rust:1.68-alpine3.17 AS bin-builder -RUN export DEBIAN_FRONTEND=noninteractive && \ - apt-get update && \ - apt-get install clang nettle-dev pkg-config libssl-dev -y COPY backend . -RUN cargo build --release +RUN apk add --no-cache openssl-dev openssl-libs-static musl-dev +RUN export OPENSSL_STATIC=1 && \ + export OPENSSL_LIB_DIR=/usr/lib &&\ + export OPENSSL_INCLUDE_DIR=/usr/include/openssl && \ + cargo build --release -FROM node:19 AS webpage-builder +FROM node:19-alpine3.17 AS webpage-builder COPY website . RUN npm install -g pnpm && \ @@ -17,16 +18,11 @@ COPY assets assets RUN mv dist assets/webpage -FROM debian:bullseye-slim +FROM alpine:3.17 WORKDIR /wkd -RUN export DEBIAN_FRONTEND=noninteractive && \ - apt-get update && \ - apt-get install ca-certificates -y && \ - rm -rf /var/lib/apt/lists/* && \ - adduser --no-create-home wkd && \ - chown -R wkd:wkd /wkd && \ - chmod -R 777 /wkd +RUN adduser --no-create-home --disabled-password wkd && \ + chown -R wkd:wkd /wkd USER wkd COPY --from=webpage-builder assets assets COPY --from=bin-builder target/release/simple-wkd wkd diff --git a/backend/Cargo.lock b/backend/Cargo.lock index 6bfaeea..94e3d6e 100644 --- a/backend/Cargo.lock +++ b/backend/Cargo.lock @@ -297,7 +297,7 @@ checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" dependencies = [ "proc-macro2", "quote", - "syn 2.0.14", + "syn 2.0.15", ] [[package]] @@ -318,26 +318,6 @@ version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" -[[package]] -name = "bindgen" -version = "0.63.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36d860121800b2a9a94f9b5604b332d5cffb234ce17609ea479d723dbc9d3885" -dependencies = [ - "bitflags", - "cexpr", - "clang-sys", - "lazy_static", - "lazycell", - "peeking_take_while", - "proc-macro2", - "quote", - "regex", - "rustc-hash", - "shlex", - "syn 1.0.109", -] - [[package]] name = "bit-set" version = "0.5.3" @@ -395,8 +375,6 @@ version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0dd286184b392a1ce6b3deecd073f0330df194bf935b87f852147d50d0d2d18" dependencies = [ - "bzip2", - "flate2", "lazy_static", "libc", ] @@ -422,27 +400,6 @@ dependencies = [ "bytes", ] -[[package]] -name = "bzip2" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdb116a6ef3f6c3698828873ad02c3014b3c85cadb88496095628e3ef1e347f8" -dependencies = [ - "bzip2-sys", - "libc", -] - -[[package]] -name = "bzip2-sys" -version = "0.1.11+1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" -dependencies = [ - "cc", - "libc", - "pkg-config", -] - [[package]] name = "cc" version = "1.0.79" @@ -452,15 +409,6 @@ dependencies = [ "jobserver", ] -[[package]] -name = "cexpr" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" -dependencies = [ - "nom", -] - [[package]] name = "cfg-if" version = "1.0.0" @@ -482,17 +430,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "clang-sys" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c688fc74432808e3eb684cae8830a86be1d66a2bd58e1f248ed0960a590baf6f" -dependencies = [ - "glob", - "libc", - "libloading", -] - [[package]] name = "codespan-reporting" version = "0.11.1" @@ -594,7 +531,7 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn 2.0.14", + "syn 2.0.15", ] [[package]] @@ -611,7 +548,7 @@ checksum = "2345488264226bf682893e25de0769f3360aac9957980ec49361b083ddaa5bc5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.14", + "syn 2.0.15", ] [[package]] @@ -864,7 +801,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.14", + "syn 2.0.15", ] [[package]] @@ -939,9 +876,9 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "h2" -version = "0.3.16" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5be7b54589b581f624f566bf5d8eb2bab1db736c51528720b6bd36b96b55924d" +checksum = "66b91535aa35fea1523ad1b86cb6b53c28e0ae566ba4a460f4457e936cad7c6f" dependencies = [ "bytes", "fnv", @@ -1036,9 +973,9 @@ checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" [[package]] name = "hyper" -version = "0.14.25" +version = "0.14.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc5e554ff619822309ffd57d8734d77cd5ce6238bc956f037ea06c58238c9899" +checksum = "ab302d72a6f11a3b910431ff93aae7e773078c769f0a3ef15fb9ec692ed147d4" dependencies = [ "bytes", "futures-channel", @@ -1249,12 +1186,6 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" - [[package]] name = "lettre" version = "0.10.4" @@ -1284,16 +1215,6 @@ version = "0.2.141" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3304a64d199bb964be99741b7a14d26972741915b3649639149b2479bb46f4b5" -[[package]] -name = "libloading" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" -dependencies = [ - "cfg-if", - "winapi", -] - [[package]] name = "link-cplusplus" version = "1.0.8" @@ -1446,32 +1367,6 @@ dependencies = [ "tempfile", ] -[[package]] -name = "nettle" -version = "7.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ff5d538c014cb58ab701db16e28aa66fbbb8b472bf65821d0e84f72aae6d4f" -dependencies = [ - "getrandom 0.2.9", - "libc", - "nettle-sys", - "thiserror", -] - -[[package]] -name = "nettle-sys" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5df7cd7e8d5d2997055f31318d1ec648c84886e662bbef7b4a60e3cbc899522b" -dependencies = [ - "bindgen", - "cc", - "libc", - "pkg-config", - "tempfile", - "vcpkg", -] - [[package]] name = "new_debug_unreachable" version = "1.0.4" @@ -1565,7 +1460,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.14", + "syn 2.0.15", ] [[package]] @@ -1621,12 +1516,6 @@ version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" -[[package]] -name = "peeking_take_while" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" - [[package]] name = "percent-encoding" version = "2.2.0" @@ -1849,12 +1738,6 @@ dependencies = [ "quick-error", ] -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - [[package]] name = "rustc_version" version = "0.4.0" @@ -1974,10 +1857,9 @@ dependencies = [ "anyhow", "base64 0.13.1", "buffered-reader", - "bzip2", "chrono", "dyn-clone", - "flate2", + "foreign-types-shared", "getrandom 0.2.9", "idna 0.3.0", "lalrpop", @@ -1985,8 +1867,9 @@ dependencies = [ "lazy_static", "libc", "memsec", - "nettle", "once_cell", + "openssl", + "openssl-sys", "rand 0.7.3", "regex", "regex-syntax", @@ -2012,7 +1895,7 @@ checksum = "291a097c63d8497e00160b166a967a4a79c64f3facdd01cbd7502231688d77df" dependencies = [ "proc-macro2", "quote", - "syn 2.0.14", + "syn 2.0.15", ] [[package]] @@ -2068,12 +1951,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "shlex" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" - [[package]] name = "signal-hook-registry" version = "1.4.1" @@ -2161,9 +2038,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.14" +version = "2.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcf316d5356ed6847742d036f8a39c3b8435cac10bd528a4bd461928a6ab34d5" +checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822" dependencies = [ "proc-macro2", "quote", @@ -2196,9 +2073,9 @@ dependencies = [ [[package]] name = "termcolor" -version = "1.1.3" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" dependencies = [ "winapi-util", ] @@ -2220,7 +2097,7 @@ checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.14", + "syn 2.0.15", ] [[package]] @@ -2312,7 +2189,7 @@ checksum = "61a573bdc87985e9d6ddeed1b3d864e8a302c847e40d647746df2f1de209d1ce" dependencies = [ "proc-macro2", "quote", - "syn 2.0.14", + "syn 2.0.15", ] [[package]] diff --git a/backend/Cargo.toml b/backend/Cargo.toml index 04f59ec..3c5c155 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -3,8 +3,6 @@ name = "simple-wkd" version = "0.1.0" edition = "2021" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - [dependencies] actix-files = "0.6.2" actix-web = "4.3.1" @@ -15,7 +13,7 @@ log = "0.4.17" once_cell = "1.17.1" rand = "0.8.5" sequoia-net = "0.27.0" -sequoia-openpgp = "1.14.0" +sequoia-openpgp = { version = "1.14.0", default-features = false, features = ["crypto-openssl"] } serde = { version = "1.0.160", features = ["derive"] } thiserror = "1.0.40" tokio = { version = "1.27.0", features = ["time"] }