2022-04-11 12:44:51 +05:30
|
|
|
FROM nimlang/nim:alpine as builder
|
2022-04-11 12:26:39 +05:30
|
|
|
|
2022-04-25 12:19:15 +05:30
|
|
|
RUN apk update && apk add git \
|
|
|
|
build-base \
|
|
|
|
curl \
|
|
|
|
bash \
|
2022-05-01 03:05:47 +05:30
|
|
|
openssl3 \
|
|
|
|
openssl3-dev \
|
|
|
|
openssl3-libs-static \
|
2022-04-25 12:19:15 +05:30
|
|
|
sqlite-dev \
|
|
|
|
sqlite-static
|
2022-04-11 12:26:39 +05:30
|
|
|
|
|
|
|
COPY . /app
|
2022-04-11 12:44:51 +05:30
|
|
|
WORKDIR /app
|
2022-04-11 12:26:39 +05:30
|
|
|
|
|
|
|
# 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 \
|
2022-05-08 20:29:52 +05:30
|
|
|
--passL:"-flto" \
|
2022-05-01 02:47:42 +05:30
|
|
|
-d:release \
|
2022-04-25 10:07:06 +05:30
|
|
|
--opt:speed \
|
2022-07-22 11:22:36 +05:30
|
|
|
--mm:orc \
|
2022-07-22 11:31:24 +05:30
|
|
|
--deepcopy=on \
|
2022-04-11 12:44:51 +05:30
|
|
|
--accept
|
2022-04-11 12:26:39 +05:30
|
|
|
|
2022-05-08 20:29:52 +05:30
|
|
|
RUN strip -s /app/nim_censor_bot && \
|
|
|
|
strip -R .comment -R .note -R .note.ABI-tag /app/nim_censor_bot
|
|
|
|
|
2022-04-25 12:32:20 +05:30
|
|
|
FROM scratch
|
2022-04-11 12:26:39 +05:30
|
|
|
|
2022-04-11 12:44:51 +05:30
|
|
|
COPY --from=builder /app/nim_censor_bot /
|
2022-04-25 12:32:20 +05:30
|
|
|
COPY --from=builder /etc/ssl/certs /etc/ssl/certs
|
2022-04-11 12:44:51 +05:30
|
|
|
|
|
|
|
ENV DB_HOST="/data/censordata.db"
|
|
|
|
|
2022-04-11 15:45:42 +05:30
|
|
|
EXPOSE 8080
|
2022-04-11 12:44:51 +05:30
|
|
|
VOLUME /data
|
|
|
|
|
2022-04-11 12:26:39 +05:30
|
|
|
CMD ["./nim_censor_bot"]
|