Compress the final binary to decrease the size of docker image.

This commit is contained in:
Lukasz Raczylo 2021-05-26 09:17:04 +01:00
parent e105effc47
commit 19df81bbe8
No known key found for this signature in database
GPG Key ID: 4C68D09621D47E6B

View File

@ -1,9 +1,10 @@
FROM alpine:latest as buildBase FROM alpine:latest as buildBase
RUN apk add --no-cache alpine-sdk linux-headers git zlib-dev openssl-dev gperf php cmake RUN apk add --no-cache upx alpine-sdk linux-headers git zlib-dev openssl-dev gperf php cmake
ADD . /srv ADD . /srv
WORKDIR /srv WORKDIR /srv
RUN git submodule update --init --recursive && mkdir -p build && cd build && cmake -DCMAKE_INSTALL_PREFIX:PATH=../tdlib -DCMAKE_BUILD_TYPE=Release .. RUN git submodule update --init --recursive && mkdir -p build && cd build && cmake -DCMAKE_INSTALL_PREFIX:PATH=../tdlib -DCMAKE_BUILD_TYPE=Release ..
RUN cd /srv/build && cmake --build . --target install RUN cd /srv/build && cmake --build . --target install
RUN upx --best /srv/build/telegram-bot-api
FROM alpine:latest FROM alpine:latest
RUN apk add --no-cache zlib-dev openssl-dev libstdc++ RUN apk add --no-cache zlib-dev openssl-dev libstdc++