2020-11-09 16:17:37 +01:00
|
|
|
FROM alpine:3.12 as build
|
2020-11-06 01:42:25 +01:00
|
|
|
|
2020-11-09 16:17:37 +01:00
|
|
|
RUN apk add --no-cache --update alpine-sdk linux-headers git zlib-dev openssl-dev gperf cmake
|
2020-11-06 01:42:25 +01:00
|
|
|
|
2020-11-09 16:17:37 +01:00
|
|
|
WORKDIR /usr/src/telegram-bot-api
|
2020-11-06 01:42:25 +01:00
|
|
|
|
2020-11-09 16:17:37 +01:00
|
|
|
COPY CMakeLists.txt /usr/src/telegram-bot-api
|
|
|
|
ADD td /usr/src/telegram-bot-api/td
|
|
|
|
ADD telegram-bot-api /usr/src/telegram-bot-api/telegram-bot-api
|
2020-11-06 01:42:25 +01:00
|
|
|
|
2020-11-09 16:17:37 +01:00
|
|
|
RUN mkdir -p build \
|
|
|
|
&& cd build \
|
|
|
|
&& cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=.. .. \
|
|
|
|
&& cmake --build . --target install -j $(nproc) \
|
|
|
|
&& strip /usr/src/telegram-bot-api/bin/telegram-bot-api
|
2020-11-06 01:42:25 +01:00
|
|
|
|
2020-11-09 16:17:37 +01:00
|
|
|
FROM alpine:3.12
|
2020-11-06 01:42:25 +01:00
|
|
|
|
2020-11-25 08:32:01 +01:00
|
|
|
ENV TELEGRAM_WORK_DIR="/var/lib/telegram-bot-api" \
|
2020-11-09 16:17:37 +01:00
|
|
|
TELEGRAM_TEMP_DIR="/tmp/telegram-bot-api"
|
2020-11-06 01:42:25 +01:00
|
|
|
|
2020-11-09 16:17:37 +01:00
|
|
|
RUN apk add --no-cache --update openssl libstdc++ curl
|
|
|
|
COPY --from=build /usr/src/telegram-bot-api/bin/telegram-bot-api /usr/local/bin/telegram-bot-api
|
2020-11-08 13:40:45 +01:00
|
|
|
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
2020-11-09 16:17:37 +01:00
|
|
|
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 \
|
2020-11-25 08:32:01 +01:00
|
|
|
&& mkdir -p ${TELEGRAM_WORK_DIR} ${TELEGRAM_TEMP_DIR} \
|
|
|
|
&& chown telegram-bot-api:telegram-bot-api ${TELEGRAM_WORK_DIR} \
|
|
|
|
&& chown nobody:nobody ${TELEGRAM_TEMP_DIR}
|
|
|
|
USER telegram-bot-api:telegram-bot-api
|
2020-11-09 16:17:37 +01:00
|
|
|
|
2020-11-11 18:14:25 +01:00
|
|
|
HEALTHCHECK CMD curl -f http://localhost:8082/ || exit 1
|
2020-11-09 16:17:37 +01:00
|
|
|
EXPOSE 8081/tcp 8082/tcp
|
2020-11-08 13:40:45 +01:00
|
|
|
ENTRYPOINT ["/docker-entrypoint.sh"]
|