mirror of
https://github.com/PaiGramTeam/telegram-bot-api-build.git
synced 2024-11-21 14:38:23 +00:00
Add Dockerfile
This commit is contained in:
parent
e285f54a80
commit
abc00b8718
31
Dockerfile
Normal file
31
Dockerfile
Normal file
@ -0,0 +1,31 @@
|
||||
FROM alpine:3.12 as build
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
FROM alpine:3.12
|
||||
|
||||
ENV TELEGRAM_LOGS_DIR="/var/log/telegram-bot-api" \
|
||||
TELEGRAM_WORK_DIR="/var/lib/telegram-bot-api" \
|
||||
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_LOGS_DIR} ${TELEGRAM_WORK_DIR} ${TELEGRAM_TEMP_DIR} \
|
||||
&& chown telegram-bot-api:telegram-bot-api ${TELEGRAM_LOGS_DIR} ${TELEGRAM_WORK_DIR} \
|
||||
&& chown nobody:nobody /tmp/telegram-bot-api
|
||||
|
||||
EXPOSE 8081/tcp 8082/tcp
|
||||
ENTRYPOINT ["/docker-entrypoint.sh"]
|
Loading…
Reference in New Issue
Block a user