From 333aa3d8107bae7e0b021511fccd9c86dec5198f Mon Sep 17 00:00:00 2001 From: Ayaka Date: Tue, 9 Apr 2024 00:38:30 +1200 Subject: [PATCH 1/2] Update Dockerfile.old --- Dockerfile => Dockerfile.old | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Dockerfile => Dockerfile.old (100%) diff --git a/Dockerfile b/Dockerfile.old similarity index 100% rename from Dockerfile rename to Dockerfile.old From 91eecdab9d4f73eb3dbc374bddbecd958f1bfa68 Mon Sep 17 00:00:00 2001 From: Ayaka Date: Tue, 9 Apr 2024 00:39:22 +1200 Subject: [PATCH 2/2] 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"] +