[PATCH] add a containerfile to ship davcli and vdirsyncer in a container
Export this patch
This makes it useful for me to test this without having to install a
cargo dev environment locally and provide at least some level of
isolation for code I just pull from the internet.
---
ged, thanks.
The rust:latest image is 1.44GB, but rust:alpine is 790MB. I might be worth
trying to use the latter, assuming that you won't need to copy the binary
outside of the container.
--
Containerfile | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
create mode 100644 Containerfile
diff --git a/Containerfile b/Containerfile
new file mode 100644
index 0000000..2dce122
--- /dev/null
+++ b/Containerfile
@@ -0,0 +1,24 @@
+ FROM rust:latest AS builder
+
+ RUN useradd --home /home/user -M user -K UID_MIN=10000 -K GID_MIN=10000 && mkdir /home/user && chown user /home/user && chmod 0770 /home/user
+
+ USER user
+
+ WORKDIR /home/user
+
+ COPY --chown=user . /home/user/vdirsyncer-rs
+
+ RUN cd /home/user/vdirsyncer-rs && cargo build
+
+ FROM debian:stable-slim
+
+ RUN useradd --home /home/user -M user -K UID_MIN=10000 -K GID_MIN=10000 && mkdir /home/user && chown user /home/user && chmod 0770 /home/user && apt update && apt upgrade -y && apt install -y libsqlite3-0 libgcc-s1 && apt clean && rm -rf /var/lib/apt/lists/*
+
+ USER user
+
+ WORKDIR /home/user
+
+ COPY --from=builder /home/user/vdirsyncer-rs/target/debug/davcli /usr/local/bin/
+ COPY --from=builder /home/user/vdirsyncer-rs/target/debug/vdirsyncer /usr/local/bin/
+
+ ENTRYPOINT ["/usr/local/bin/vdirsyncer"]
--
2.39.2