Add staging.Dockerfile
This commit is contained in:
parent
67c38823f2
commit
908bd76aac
|
@ -29,7 +29,7 @@ WORKDIR /src
|
||||||
RUN make ${MAKEOPTS}
|
RUN make ${MAKEOPTS}
|
||||||
|
|
||||||
FROM scratch AS telegabber
|
FROM scratch AS telegabber
|
||||||
COPY --from=build /src/telegabber /usr/local/bin/
|
COPY --from=build /src/release/telegabber /usr/local/bin/
|
||||||
ENTRYPOINT ["/usr/local/bin/telegabber"]
|
ENTRYPOINT ["/usr/local/bin/telegabber"]
|
||||||
|
|
||||||
FROM scratch AS binaries
|
FROM scratch AS binaries
|
||||||
|
|
6
Makefile
6
Makefile
|
@ -6,7 +6,8 @@ VERSION := "v1.9.1"
|
||||||
MAKEOPTS := "-j4"
|
MAKEOPTS := "-j4"
|
||||||
|
|
||||||
all:
|
all:
|
||||||
go build -ldflags "-X main.commit=${COMMIT}" -o telegabber
|
mkdir -p release
|
||||||
|
go build -ldflags "-X main.commit=${COMMIT}" -o release/telegabber
|
||||||
|
|
||||||
test:
|
test:
|
||||||
go test -v ./config ./ ./telegram ./xmpp ./xmpp/gateway ./persistence ./telegram/formatter ./badger
|
go test -v ./config ./ ./telegram ./xmpp ./xmpp/gateway ./persistence ./telegram/formatter ./badger
|
||||||
|
@ -16,3 +17,6 @@ lint:
|
||||||
|
|
||||||
build_indocker:
|
build_indocker:
|
||||||
docker build --build-arg "TD_COMMIT=${TD_COMMIT}" --build-arg "VERSION=${VERSION}" --build-arg "MAKEOPTS=${MAKEOPTS}" --output=release --target binaries .
|
docker build --build-arg "TD_COMMIT=${TD_COMMIT}" --build-arg "VERSION=${VERSION}" --build-arg "MAKEOPTS=${MAKEOPTS}" --output=release --target binaries .
|
||||||
|
|
||||||
|
build_indocker_staging:
|
||||||
|
DOCKER_BUILDKIT=1 docker build --build-arg "TD_COMMIT=${TD_COMMIT}" --build-arg "MAKEOPTS=${MAKEOPTS}" --network host --output=release --target binaries -f staging.Dockerfile .
|
||||||
|
|
43
staging.Dockerfile
Normal file
43
staging.Dockerfile
Normal file
|
@ -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 /
|
Loading…
Reference in a new issue