-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
47 lines (42 loc) · 1.94 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Note: This file contains four environment variables near the end. Change
# (#1) these to match your settings or you will not be able to connect the bot
# to a Matrix homeserver.
# Note: This Dockerfile uses multi-stage builds. Therefore, the required Docker
# (#2) version is 17.05 or (preferably) a later version on the client and
# server side of Docker.
# build stage
FROM debian:12-slim AS builder
LABEL maintainer="Dirk Stolle <striezel-dev@web.de>"
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y catch2 cmake g++ git libcurl4-gnutls-dev libsqlite3-dev pkg-config
RUN mkdir -p /opt/bvn
COPY ./ /opt/bvn
WORKDIR /opt/bvn
RUN mkdir build && cd build && cmake .. && make -j4 && ctest
# runtime stage
FROM debian:12-slim AS runner
LABEL maintainer="Dirk Stolle <striezel-dev@web.de>"
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y --no-install-recommends --no-install-suggests \
ca-certificates libcurl3-gnutls libsqlite3-0 fortune-mod fortunes-min
# You may want to add more or other fortune packages here. See
# <https://packages.debian.org/en/buster/fortune-cookie-db> for more packages.
COPY --from=builder /opt/bvn/build/src/botvinnik/botvinnik /usr/local/bin/botvinnik
# Create new user that will be used to run the program.
RUN useradd --create-home bot
USER bot
WORKDIR /home/bot
# Test that executable is reachable via PATH variable.
RUN botvinnik --version
RUN mkdir -p /home/bot/.bvn
# Note: Change these four variables to match your setup!
ENV HOMESERVER=https://matrix.org/
ENV BOT_USER=@alice-and-bob:charlie.tld
ENV BOT_PASSWORD=secret
ENV BOT_STOP_USER=@charlie:charlie.tld
# Generate configuration file.
RUN echo "matrix.homeserver=$HOMESERVER" > /home/bot/.bvn/bvn.conf && \
echo "matrix.userid=$BOT_USER" >> /home/bot/.bvn/bvn.conf && \
echo "matrix.password=$BOT_PASSWORD" >> /home/bot/.bvn/bvn.conf && \
echo "bot.stop.allowed.userid=$BOT_STOP_USER" >> /home/bot/.bvn/bvn.conf
CMD botvinnik