| FROM ubuntu:latest | |
| RUN apt-get update && apt-get install -y \ | |
| curl \ | |
| netcat \ | |
| && rm -rf /var/lib/apt/lists/* | |
| RUN --mount=type=secret,id=URL,mode=0444,required=true \ | |
| --mount=type=secret,id=FILE_NAME,mode=0444,required=true \ | |
| mkdir /bot-data && \ | |
| curl -L -o /bot-data/$(cat /run/secrets/FILE_NAME) $(cat /run/secrets/URL) | |
| RUN chmod +x /bot-data/telegram-bot-api | |
| WORKDIR /bot-data | |
| RUN chmod 777 /bot-data | |
| RUN echo 'while true; do { echo -e "HTTP/1.1 200 OK\n\nHello World!" | nc -l -p 7860; } done' > /bot-data/hello-world.sh | |
| RUN chmod +x /bot-data/hello-world.sh | |
| EXPOSE 7860 8081 | |
| RUN --mount=type=secret,id=ApiID,mode=0444,required=true \ | |
| --mount=type=secret,id=ApiHash,mode=0444,required=true | |
| CMD ./telegram-bot-api --verbosity=0 --local --api-id=$ApiID --api-hash=$ApiHash --temp-dir=/bot-data --dir=/bot-data & ./hello-world.sh |