aboutsummaryrefslogtreecommitdiff
path: root/Dockerfile
diff options
context:
space:
mode:
authorBohdan Horbeshko <bodqhrohro@gmail.com>2023-09-17 06:16:09 +0300
committerBohdan Horbeshko <bodqhrohro@gmail.com>2023-09-17 06:16:09 +0300
commit9dbd487dae9b5a74981873722be685d3706ab772 (patch)
treef5d5ab8fc1718a58cd5630aa6365f624a6fdbe98 /Dockerfile
parent7eaf28ad7c4d2bdf5aa6313503d751de90a6811c (diff)
parent282a6fc21b9626ab1bdc9c5a78162d90b7d28aa2 (diff)
Merge branch 'master' into muc
Diffstat (limited to 'Dockerfile')
-rw-r--r--Dockerfile36
1 files changed, 36 insertions, 0 deletions
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..6fea570
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,36 @@
+FROM golang:1.19-bookworm AS base
+
+RUN apt-get update
+run apt-get install -y libssl-dev cmake build-essential gperf libz-dev make git
+
+FROM base AS tdlib
+
+ARG TD_COMMIT
+ARG MAKEOPTS
+RUN git clone https://github.com/tdlib/td /src/
+RUN git -C /src/ checkout "${TD_COMMIT}"
+RUN mkdir build
+WORKDIR /build/
+RUN cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/compiled/ /src/
+RUN cmake --build . ${MAKEOPTS}
+RUN make install
+
+FROM base AS cache
+ARG VERSION
+COPY --from=tdlib /compiled/ /usr/local/
+COPY ./ /src
+RUN git -C /src checkout "${VERSION}"
+WORKDIR /src
+RUN go get
+
+FROM cache AS build
+ARG MAKEOPTS
+WORKDIR /src
+RUN make ${MAKEOPTS}
+
+FROM scratch AS telegabber
+COPY --from=build /src/telegabber /usr/local/bin/
+ENTRYPOINT ["/usr/local/bin/telegabber"]
+
+FROM scratch AS binaries
+COPY --from=telegabber /usr/local/bin/telegabber /