mirror of
https://github.com/tdlight-team/tdlight-telegram-bot-api.git
synced 2024-11-30 07:32:53 +01:00
Various Dockerfile fixes and enhancements (#13)
* fix docker file and add in readme * fix Readme
This commit is contained in:
parent
8943f285a7
commit
19c38c61b3
11
Dockerfile
11
Dockerfile
@ -5,7 +5,6 @@ RUN apk add --no-cache --update alpine-sdk linux-headers git zlib-dev openssl-de
|
||||
WORKDIR /usr/src/telegram-bot-api
|
||||
|
||||
COPY CMakeLists.txt /usr/src/telegram-bot-api
|
||||
COPY docker-entrypoint.sh /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
|
||||
|
||||
@ -17,8 +16,7 @@ RUN mkdir -p build \
|
||||
|
||||
FROM alpine:3.12
|
||||
|
||||
ENV TELEGRAM_LOGS_DIR="/var/log/telegram-bot-api" \
|
||||
TELEGRAM_WORK_DIR="/var/lib/telegram-bot-api" \
|
||||
ENV TELEGRAM_WORK_DIR="/var/lib/telegram-bot-api" \
|
||||
TELEGRAM_TEMP_DIR="/tmp/telegram-bot-api"
|
||||
|
||||
RUN apk add --no-cache --update openssl libstdc++ curl
|
||||
@ -27,9 +25,10 @@ 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
|
||||
&& 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
|
||||
|
||||
HEALTHCHECK CMD curl -f http://localhost:8082/ || exit 1
|
||||
EXPOSE 8081/tcp 8082/tcp
|
||||
|
@ -129,7 +129,12 @@ The bot will now receive Updates for all received media, even if a destruction t
|
||||
<a name="installation"></a>
|
||||
## Installation
|
||||
|
||||
The simplest way to build and install `Telegram Bot API server` is to use our [Telegram Bot API server build instructions generator](https://tdlib.github.io/telegram-bot-api/build.html).
|
||||
The simplest way to use it is with this docker command:
|
||||
```
|
||||
docker run -p 8081:8081 --env TELEGRAM_API_ID=API_ID --env TELEGRAM_API_HASH=API_HASH tdlight/tdlightbotapi
|
||||
```
|
||||
|
||||
The simplest way to build `Telegram Bot API server` is to use our [Telegram Bot API server build instructions generator](https://tdlib.github.io/telegram-bot-api/build.html).
|
||||
If you do that, you'll only need to choose the target operating system to receive the complete build instructions.
|
||||
|
||||
In general, you need to install all `Telegram Bot API server` [dependencies](#dependencies) and compile the source code using CMake:
|
||||
|
@ -1,18 +1,17 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
LOG_FILENAME="telegram-bot-api.log"
|
||||
|
||||
USERNAME=telegram-bot-api
|
||||
GROUPNAME=telegram-bot-api
|
||||
|
||||
chown ${USERNAME}:${GROUPNAME} "${TELEGRAM_LOGS_DIR}" "${TELEGRAM_WORK_DIR}"
|
||||
chown ${USERNAME}:${GROUPNAME} "${TELEGRAM_WORK_DIR}"
|
||||
|
||||
if [ -n "${1}" ]; then
|
||||
exec "${*}"
|
||||
fi
|
||||
|
||||
DEFAULT_ARGS="--http-port 8081 --dir=${TELEGRAM_WORK_DIR} --temp-dir=${TELEGRAM_TEMP_DIR} --log=${TELEGRAM_LOGS_DIR}/${LOG_FILENAME} --username=${USERNAME} --groupname=${GROUPNAME}"
|
||||
DEFAULT_ARGS="--http-port 8081 --dir=${TELEGRAM_WORK_DIR} --temp-dir=${TELEGRAM_TEMP_DIR}"
|
||||
CUSTOM_ARGS=""
|
||||
|
||||
if [ -n "$TELEGRAM_STAT" ]; then
|
||||
@ -48,6 +47,11 @@ fi
|
||||
if [ -n "$TELEGRAM_MAX_BATCH" ]; then
|
||||
CUSTOM_ARGS="${CUSTOM_ARGS} ---max-batch-operations=$TELEGRAM_MAX_BATCH"
|
||||
fi
|
||||
if [ -n "$TELEGRAM_LOGS" ]; then
|
||||
CUSTOM_ARGS="$CUSTOM_ARGS --log=${TELEGRAM_LOGS}"
|
||||
else
|
||||
CUSTOM_ARGS="$CUSTOM_ARGS --log=/proc/1/fd/1"
|
||||
fi
|
||||
|
||||
COMMAND="telegram-bot-api ${DEFAULT_ARGS}${CUSTOM_ARGS}"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user