From 46dbd88d91a127684cb52b795b881b2f81b38c92 Mon Sep 17 00:00:00 2001 From: spikecodes <19519553+spikecodes@users.noreply.github.com> Date: Wed, 31 Mar 2021 13:05:22 -0700 Subject: [PATCH] New alpine-based Dockerfile with healthcheck --- Cargo.toml | 2 +- Dockerfile | 17 ++++++----------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c47afe4..14f5f00 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ name = "libreddit" description = " Alternative private front-end to Reddit" license = "AGPL-3.0" repository = "https://github.com/spikecodes/libreddit" -version = "0.8.2" +version = "0.8.3" authors = ["spikecodes <19519553+spikecodes@users.noreply.github.com>"] edition = "2018" diff --git a/Dockerfile b/Dockerfile index 6b4cdcb..4d82c91 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,12 @@ -FROM rust:latest as builder - +FROM rust:alpine as builder WORKDIR /usr/src/libreddit COPY . . +RUN apk add --no-cache g++ RUN cargo install --path . - -FROM debian:buster-slim - -RUN apt-get update && apt-get install -y libcurl4 && rm -rf /var/lib/apt/lists/* +FROM alpine:latest +RUN apk add --no-cache curl COPY --from=builder /usr/local/cargo/bin/libreddit /usr/local/bin/libreddit -RUN useradd --system --user-group --home-dir /nonexistent --no-create-home --shell /usr/sbin/nologin libreddit -USER libreddit - EXPOSE 8080 - -CMD ["libreddit"] +HEALTHCHECK --interval=5m --timeout=3s CMD curl -f http://localhost:8080/settings || exit 1 +CMD ["libreddit"] \ No newline at end of file