Add a dockerfile and statically link everything
Signed-off-by: baalajimaestro <me@baalajimaestro.me>
This commit is contained in:
parent
fbda01b355
commit
c5f4b66d25
1 changed files with 25 additions and 0 deletions
25
Dockerfile
Normal file
25
Dockerfile
Normal file
|
@ -0,0 +1,25 @@
|
|||
FROM nimlang/nim:alpine
|
||||
|
||||
RUN apk update && apk add git build-base curl bash openssl openssl-dev openssl-libs-static sqlite-dev sqlite-static
|
||||
|
||||
COPY . /app
|
||||
|
||||
# Build with necessary params to enable statically linking openssl, glibc and sqlite3
|
||||
RUN nimble build --passL:-L/usr/lib \
|
||||
-d:ssl \
|
||||
-p:. \
|
||||
--dynlibOverride:ssl \
|
||||
--dynlibOverride:crypto \
|
||||
--dynlibOverride:sqlite3 \
|
||||
--passl:-lssl \
|
||||
--passl:-lsqlite3 \
|
||||
--passl:-lcrypto \
|
||||
--passL:-static \
|
||||
-d:release \
|
||||
--opt:size
|
||||
|
||||
# Our binary lives in this image
|
||||
FROM gcr.io/distroless/base:latest
|
||||
|
||||
COPY --from=builder nim_censor_bot /
|
||||
CMD ["./nim_censor_bot"]
|
Loading…
Reference in a new issue