aboutsummaryrefslogtreecommitdiff
path: root/staging.Dockerfile
diff options
context:
space:
mode:
authorBohdan Horbeshko <bodqhrohro@gmail.com>2024-03-29 14:39:10 +0300
committerBohdan Horbeshko <bodqhrohro@gmail.com>2024-03-29 14:39:10 +0300
commit908bd76aacfae7ae11b49e83da060232703bfa4f (patch)
treec49d52cf07889697505484185858081f896a11c2 /staging.Dockerfile
parent67c38823f2b053928c6c0a5a13261b891e9db4d3 (diff)
Add staging.Dockerfile
Diffstat (limited to 'staging.Dockerfile')
-rw-r--r--staging.Dockerfile43
1 files changed, 43 insertions, 0 deletions
diff --git a/staging.Dockerfile b/staging.Dockerfile
new file mode 100644
index 0000000..7b9a91b
--- /dev/null
+++ b/staging.Dockerfile
@@ -0,0 +1,43 @@
+FROM golang:1.19-bullseye AS base
+
+RUN apt-get update
+RUN apt-get install -y libssl-dev cmake build-essential gperf libz-dev make git php
+
+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 . --target prepare_cross_compiling ${MAKEOPTS}
+WORKDIR /src/
+RUN php SplitSource.php
+WORKDIR /build/
+RUN cmake --build . ${MAKEOPTS}
+RUN make install
+
+FROM base AS cache
+ARG VERSION
+COPY --from=tdlib /compiled/ /usr/local/
+WORKDIR /src
+RUN --mount=type=cache,target=/go \
+ --mount=type=cache,target=/root/.cache/go-build \
+ --mount=type=bind,source=./,target=/src \
+ go get
+
+FROM cache AS build
+ARG MAKEOPTS
+WORKDIR /src
+RUN --mount=type=bind,source=./,target=/src,rw \
+ --mount=type=cache,destination=/src/release \
+ make ${MAKEOPTS}
+
+FROM build AS release
+RUN --mount=type=cache,destination=/src/release \
+ cp /src/release/telegabber /
+
+FROM scratch AS binaries
+COPY --from=release /telegabber /