A Flask application containerized demonstrating Environment Variables and Orchestration with Docker Compose.
app.py: Python web server that readsAPP_ENVfrom the system.Dockerfile: Instructions to build the secure container image.docker-compose.yml: Orchestration file to define ports and config.
-
Build & Run: Uses
docker-composeto build the image and start the container with custom variables.docker-compose up -d
-
Access: Go to
http://localhost:8080You should see: "Hello from Production (Alexandre's Lab)". -
Cleanup: To stop and remove everything:
docker-compose down
You can change the environment without touching the code by editing docker-compose.yml:
environment:
- APP_ENV=Staging