This repository manages the deployment of an SMS bot application onto a Raspberry Pi using Docker. It involves automated workflows to build, deploy, and update the Docker image, as well as a Python script for checking and updating the running container.
- ✅ Basic functionality completed
- ⬜ Implement an API endpoint to fetch or update tokens dynamically.
- ⬜ Check container status on startup; if not running, start the container.
- Triggers: Automatically runs on every push to the
mainbranch. - Steps:
- Send Notification (Started): Notifies via Telegram that deployment has started.
- Build: Sets up Node.js, installs dependencies, builds the application, logs in to Docker Hub, and builds the Docker image for ARM64 architecture.
- Send Notification (Successful): Sends a Telegram message if the deployment to Docker Hub was successful.
- Send Notification (Failed): Notifies about deployment failure via Telegram.
- A systemd service for running a Python script (
main.py) to continuously check and update the Docker container if a new image is available.
.github/workflows/deploy-dockerhub.yml: GitHub Actions workflow for deploying to Docker Hub.auto-pull-docker/.service: systemd service file for the Python script.auto-pull-docker/main.py: Python script to check for image updates and restart the container..env.sample: Sample environment file for configuring application-specific variables.app.js: Node.js application for managing the bot functionality.
- GitHub Actions Workflow: Automatically builds and deploys the Docker image to Docker Hub on every push to the
mainbranch. - Auto-Pull Docker Service: Runs the Python script continuously on the Raspberry Pi to check for updates and restarts the container if a new image is available.
- Environment Variables: Ensure the required environment variables are set in a
.envfile based on the provided.env.sample.
- Clone this repository onto your Raspberry Pi.
- Modify the
.env.samplefile and save it as.envwith the necessary environment variables. - Start the Auto-Pull Docker service using the provided
.servicefile.
sudo cp auto-pull-docker/.service /etc/systemd/system/auto-pull-docker.service
sudo systemctl daemon-reload
sudo systemctl enable auto-pull-docker.service
sudo systemctl start auto-pull-docker.serviceNote: Ensure the required permissions are set for executing the Python script.
Contributions to improve this deployment setup are welcome!
Fork the repository, make your changes, and submit a pull request.