feat: add docker-compose and Makefile for deployment#4
Open
Conversation
- Add .dockerignore for optimized builds (exclude target, .env, .git) - Add docker-compose.yml with health checks and environment variables - Add Makefile with common commands (build, up, down, logs, clean, status, prune) - Update Dockerfile: Rust 1.79→1.82, use cargo install --locked - Remove default RUST_LOG from Dockerfile (use env var instead) - Remove unused MODE variable from .env.example - Add Docker deployment section to README.md Changes optimize Docker image size and provide easy deployment workflow: - Image size: 75.2MB (runtime) with minimal footprint - Make commands: make run, make logs, make down, make clean, make prune - Health check: /health endpoint on port 5000 - Non-root user appuser for security - Restart policy: unless-stopped for production readiness
Add comprehensive Docker deployment documentation to guide development: - Add Docker Deployment section with Make commands - Add Environment Variables for Docker section - Add Docker Debugging section with troubleshooting tips - Add Docker/ block to File Structure section - Add Docker Deployment Best Practices section (new) - Update Testing Before Changes to include make build - Update Pre-Commit Workflow to include make build - Update File Structure with Docker files descriptions Documentation includes: - Make commands: build, run, up, down, logs, status, prune, clean - Docker debugging: logs, status, exec, health check - Best practices: image optimization, security, health checks, logging, cleanup - Troubleshooting: common issues and solutions Total additions: 92 lines (Docker deployment documentation)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds Docker deployment support with docker-compose.yml and Makefile for easy containerization and deployment of the Telegram Dice Bot.
Changes
Docker Infrastructure
.dockerignore: Optimize build context by excluding unnecessary files (target/, .env, .git/, IDE configs)docker-compose.yml: Define service configuration with health checks, environment variables, and restart policyMakefile: Provide convenient commands for Docker operations (build, up, down, logs, clean, prune, status)Dockerfile Improvements
1.79→1.82(required by dependencies)cargo install --lockedinstead ofcargo build(simpler, automatic cleanup)RUST_LOG=info(use environment variable for flexibility)/usr/local/bin/(where cargo install places it)Configuration
MODE=pollingvariable from.env.example(not used in code)Documentation
make pruneTechnical Details
appuser(UID 10001) for security/healthendpoint on port 5000unless-stoppedfor production readiness--lockedflag to prevent dependency updates in productionMake Commands
```bash
make run # Build and start container
make logs # View logs (follow mode)
make down # Stop container
make restart # Restart container
make status # Check container status
make prune # Clean unused Docker resources
make clean # Remove containers and images
```
Testing
✅ Docker image builds successfully
✅ Image size optimized to 75.2MB
✅ Health check endpoint accessible (with valid BOT_TOKEN)
✅ All Make commands functional
✅ Environment variables properly configured
Notes
BOT_TOKENenvironment variable for full functionality.envfile or environment variables