aboutsummaryrefslogtreecommitdiff
path: root/staging.Dockerfile
blob: 7b9a91bdbaa0f9fd5f6736ef623785d6d8ca04a0 (plain) (blame)
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
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 /