From 6991fc6ae30ae08077169396e09c26921b21570c Mon Sep 17 00:00:00 2001 From: Ayaka Date: Tue, 9 Apr 2024 00:39:22 +1200 Subject: [PATCH] add build --- Dockerfile | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..429574c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,32 @@ +FROM rust:1.77.1-buster AS builder + +WORKDIR /app + +COPY ./ ./ + +RUN cargo build --release + +FROM debian:stable + +ARG TARGET + +RUN apt-get update +RUN apt-get install -y ca-certificates wget + +RUN apt-get clean -y; \ + rm -rf /var/lib/apt/lists/* /var/cache/apt/* + +COPY --from=builder /app/target/release/ /usr/local/bin + +RUN adduser --home /nonexistent --no-create-home --disabled-password redlib + +USER redlib + +# Tell Docker to expose port 808 +EXPOSE 8080 + +# Run a healthcheck every minute to make sure redlib is functional +HEALTHCHECK --interval=1m --timeout=3s CMD wget --spider --q http://localhost:8080/settings || exit 1 + +CMD ["redlib"] +