Improve Dockerfile

Signed-off-by: baalajimaestro <me@baalajimaestro.me>
This commit is contained in:
baalajimaestro 2022-04-11 12:44:51 +05:30
parent c5f4b66d25
commit 0bd5a5eb40
Signed by: baalajimaestro
GPG key ID: F93C394FE9BBAFD5

View file

@ -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"]