March 30, 2024, 11:46 a.m. | Felipe Arcaro

DEV Community dev.to




TL;DR


Here's the docker-compose.yml file to dockerize a Flask application, a Mongo database and a schedule service:



version: '3.8'

services:
app:
container_name: my_app_${ENV}
build:
context: .
ports:
- 8001:8001
depends_on:
- mongo_db
networks:
- my_network
command: ["flask", "run", "--host", "0.0.0.0", "--port", "8001"]
env_file: .env

schedule_service:
container_name: schedule_service_${ENV}
build:
context: ./scheduler
volumes:
- ./common:/app/common
- ./db:/app/db
networks:
- my_networknetwork
command: ["python", "-u", "scheduler.py"]
env_file: .env

mongo_db:
container_name: mongo_db_${ENV}
image: mongo:4.4.18
restart: always
ports:
- 27017:27017
volumes:
- ./DB-STORAGE/mongo-db-$ENV:/data/db
- ./db/init-mongo.sh:/docker-entrypoint-initdb.d/init-mongo.sh
networks: …

app application build command context database docker docker-compose file flask networks python service services

Software Engineer for AI Training Data (School Specific)

@ G2i Inc | Remote

Software Engineer for AI Training Data (Python)

@ G2i Inc | Remote

Software Engineer for AI Training Data (Tier 2)

@ G2i Inc | Remote

Data Engineer

@ Lemon.io | Remote: Europe, LATAM, Canada, UK, Asia, Oceania

Artificial Intelligence – Bioinformatic Expert

@ University of Texas Medical Branch | Galveston, TX

Lead Developer (AI)

@ Cere Network | San Francisco, US