From 471ec8c580f116b415e8393cf04fe969578a5121 Mon Sep 17 00:00:00 2001 From: gigirassy Date: Fri, 17 Jul 2026 02:34:29 +0200 Subject: [PATCH] init dockerfile --- Dockerfile | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ee88cd6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,28 @@ +# alpine for static binaries +FROM rust:alpine AS build + +# workdir, copy. +WORKDIR /src +COPY . . + +# to make the binary as tiny as possible, we'll use the nightly toolchain so we can use panic=immediate-abort and remove debug/location stuff +RUN rustup component add rust-src --toolchain nightly + +# build +RUN RUSTFLAGS="-Copt-level=z -Zfmt-debug=none -Zlocation-detail=none -Ctarget-feature=+crt-static" cargo +nightly install --path=. --root /tmp -Z build-std=std -Z build-std-features="optimize_for_size" + +# scratch runtime for security +FROM scratch + +# "nobody" user for security +USER 65535:65535 + +# copy binary into path +COPY --from=build --chown=65535:65535 /tmp/bin/teletraan /teletraan + +# expose +EXPOSE 3000 + +# to run it. the cmd is left free so people can serve single page apps with the -s flag +ENTRYPOINT ["/teletraan"] +CMD [""] \ No newline at end of file