telegram-bot-api-build/Dockerfile

32 lines
1.2 KiB
Docker
Raw Permalink Normal View History

2024-01-07 13:37:25 +00:00
ARG ALPINE_VERSION=latest
FROM alpine:${ALPINE_VERSION} AS build
2020-11-06 22:03:49 +00:00
ENV CXXFLAGS=""
WORKDIR /usr/src/telegram-bot-api
RUN apk add --no-cache --update alpine-sdk linux-headers git zlib-dev openssl-dev gperf cmake
COPY telegram-bot-api /usr/src/telegram-bot-api
2023-10-01 14:06:48 +00:00
ARG nproc=1
2020-11-06 22:03:49 +00:00
RUN mkdir -p build \
&& cd build \
&& cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=.. .. \
2023-10-01 14:06:48 +00:00
&& cmake --build . --target install -j ${nproc} \
2020-11-06 22:03:49 +00:00
&& strip /usr/src/telegram-bot-api/bin/telegram-bot-api
2024-01-07 13:37:25 +00:00
FROM alpine:${ALPINE_VERSION}
2020-11-06 22:03:49 +00:00
ENV TELEGRAM_WORK_DIR="/var/lib/telegram-bot-api" \
2020-11-06 22:03:49 +00:00
TELEGRAM_TEMP_DIR="/tmp/telegram-bot-api"
RUN apk add --no-cache --update openssl libstdc++
COPY --from=build /usr/src/telegram-bot-api/bin/telegram-bot-api /usr/local/bin/telegram-bot-api
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN addgroup -g 101 -S telegram-bot-api \
&& adduser -S -D -H -u 101 -h ${TELEGRAM_WORK_DIR} -s /sbin/nologin -G telegram-bot-api -g telegram-bot-api telegram-bot-api \
&& chmod +x /docker-entrypoint.sh \
&& mkdir -p ${TELEGRAM_WORK_DIR} ${TELEGRAM_TEMP_DIR} \
&& chown telegram-bot-api:telegram-bot-api ${TELEGRAM_WORK_DIR} ${TELEGRAM_TEMP_DIR}
2020-11-06 22:03:49 +00:00
EXPOSE 8081/tcp 8082/tcp
ENTRYPOINT ["/docker-entrypoint.sh"]