From 9779ec7b8dde8d628a2fe84b13b6ab1314e7acee Mon Sep 17 00:00:00 2001 From: Delta1925 Date: Sun, 16 Apr 2023 18:28:16 +0200 Subject: [PATCH] Use alpine linux instead of debian --- Dockerfile | 23 ++++---- backend/Cargo.lock | 129 ++------------------------------------------- backend/Cargo.toml | 2 +- docker-compose.yml | 6 +-- 4 files changed, 18 insertions(+), 142 deletions(-) diff --git a/Dockerfile b/Dockerfile index b9547fe..369ecd2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,11 @@ -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 -y COPY backend . +RUN apk add --no-cache openssl-dev musl-dev RUN 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,12 +15,13 @@ COPY assets assets RUN mv dist assets/webpage -FROM debian:bullseye-slim +FROM alpine:3.17 -WORKDIR /simplewkd -RUN adduser --no-create-home simplewkd && \ - chown -R simplewkd:simplewkd /simplewkd && \ - chmod -R 777 /simplewkd -USER simplewkd +WORKDIR /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 simple-wkd +COPY --from=bin-builder target/release/simple-wkd wkd + +ENTRYPOINT [ "/wkd/wkd" ] \ No newline at end of file diff --git a/backend/Cargo.lock b/backend/Cargo.lock index 80fab06..6e14052 100644 --- a/backend/Cargo.lock +++ b/backend/Cargo.lock @@ -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" @@ -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" @@ -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", @@ -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" diff --git a/backend/Cargo.toml b/backend/Cargo.toml index bdcac6c..5088aff 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -15,7 +15,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"] } serde_json = "1.0.96" thiserror = "1.0.40" diff --git a/docker-compose.yml b/docker-compose.yml index b1a5595..3313936 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,9 +8,9 @@ services: environment: - RUST_LOG=debug volumes: - - ./config.toml:/simplewkd/config.toml - - wkd-data:/simplewkd/data - - wkd-logs:/simplewkd/logs + - ./config.toml:/wkd/config.toml + - wkd-data:/wkd/data + - wkd-logs:/wkd/logs volumes: wkd-data: