aboutsummaryrefslogtreecommitdiff
path: root/Dockerfile
diff options
context:
space:
mode:
authorIļja Pavļikhin <owl@ow1.in>2023-08-02 01:36:27 +0300
committerIļja Pavļikhin <owl@ow1.in>2023-08-02 01:36:27 +0300
commita5f6c600357d4000b4a904e36cac1256ca3ac01d (patch)
tree25651fe521d1014faef6fbfcaacb9377c5be6835 /Dockerfile
parent131f6eba38734212e039845b6cd9deabbc9d978d (diff)
Add building in fcking docker environment
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 /