Run local Telegram Bot API in app container
This commit is contained in:
+20
@@ -1,3 +1,5 @@
|
||||
FROM aiogram/telegram-bot-api:latest AS telegram-bot-api
|
||||
|
||||
FROM python:3.12-slim
|
||||
|
||||
WORKDIR /app
|
||||
@@ -10,6 +12,15 @@ RUN apt-get update && apt-get install -y \
|
||||
git \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy the local Telegram Bot API binary and its musl runtime from the official aiogram image.
|
||||
COPY --from=telegram-bot-api /usr/local/bin/telegram-bot-api /usr/local/bin/telegram-bot-api
|
||||
COPY --from=telegram-bot-api /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1
|
||||
COPY --from=telegram-bot-api /usr/lib/libssl.so.3 /usr/lib/libssl.so.3
|
||||
COPY --from=telegram-bot-api /usr/lib/libcrypto.so.3 /usr/lib/libcrypto.so.3
|
||||
COPY --from=telegram-bot-api /usr/lib/libz.so.1 /usr/lib/libz.so.1
|
||||
COPY --from=telegram-bot-api /usr/lib/libstdc++.so.6 /usr/lib/libstdc++.so.6
|
||||
COPY --from=telegram-bot-api /usr/lib/libgcc_s.so.1 /usr/lib/libgcc_s.so.1
|
||||
|
||||
# Install python dependencies
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
@@ -17,14 +28,23 @@ RUN pip install --no-cache-dir -r requirements.txt
|
||||
# Copy source code
|
||||
COPY src/ src/
|
||||
COPY scripts/ scripts/
|
||||
COPY docker-entrypoint.sh /usr/local/bin/vk-parser-entrypoint
|
||||
RUN chmod +x /usr/local/bin/vk-parser-entrypoint \
|
||||
&& mkdir -p /var/lib/telegram-bot-api /tmp/telegram-bot-api
|
||||
|
||||
COPY favi.png .
|
||||
COPY .env.example .env
|
||||
|
||||
ENV PYTHONPATH=/app/src
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
ENV LOCAL_BOT_API_URL=http://127.0.0.1:8081
|
||||
ENV TELEGRAM_WORK_DIR=/var/lib/telegram-bot-api
|
||||
ENV TELEGRAM_TEMP_DIR=/tmp/telegram-bot-api
|
||||
ENV TELEGRAM_HTTP_PORT=8081
|
||||
ENV TELEGRAM_LOCAL=1
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
# Start uvicorn without any workers
|
||||
ENTRYPOINT ["vk-parser-entrypoint"]
|
||||
CMD ["uvicorn", "vk_parser_app.admin:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||
|
||||
Reference in New Issue
Block a user