Hello I want to containarize my flask app and my mongo annd connect them. I have already containerize the flask app.my current code:
Dockerfile for flask container
FROM python:3.8-busterWORKDIR /ergasiav3ADD . /ergasiav3RUN pip install -r requirements.txtCMD ["python","app.py"]
I have a db.py with the connection to the mongoDB, here is the code:
from flask_pymongo import pymongoCONNECTION_STRING = "mongodb+srv://admin:admin@cluster0.sqowy.mongodb.net/InfoCinemas?retryWrites=true&w=majority"client = pymongo.MongoClient(CONNECTION_STRING)db = client.get_database('InfoCinemas')Users = pymongo.collection.Collection(db, 'Users')Movies = pymongo.collection.Collection(db, 'Movies')
I also created this docker-compose.yml which seems to work but I dont know how to get the mongo as an image too.
version: '3'services: infocinemas: build: . volumes: - ./ergasiav3 ports: - 5000:5000
Do I need to make a second Dockerfile or do I just make the docker-compose.yml for the conterization of mongoDB?
Thank you in advance!