From 0bd5a5eb40200bbad6a6613e47906022539bcc96 Mon Sep 17 00:00:00 2001 From: baalajimaestro Date: Mon, 11 Apr 2022 12:44:51 +0530 Subject: [PATCH] Improve Dockerfile Signed-off-by: baalajimaestro --- Dockerfile | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index fd20a22..a15c0dc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,9 @@ -FROM nimlang/nim:alpine +FROM nimlang/nim:alpine as builder RUN apk update && apk add git build-base curl bash openssl openssl-dev openssl-libs-static sqlite-dev sqlite-static COPY . /app +WORKDIR /app # Build with necessary params to enable statically linking openssl, glibc and sqlite3 RUN nimble build --passL:-L/usr/lib \ @@ -16,10 +17,16 @@ RUN nimble build --passL:-L/usr/lib \ --passl:-lcrypto \ --passL:-static \ -d:release \ - --opt:size + --opt:size \ + --accept # Our binary lives in this image FROM gcr.io/distroless/base:latest -COPY --from=builder nim_censor_bot / +COPY --from=builder /app/nim_censor_bot / + +ENV DB_HOST="/data/censordata.db" + +VOLUME /data + CMD ["./nim_censor_bot"]