I am running a simple flask application and I have included the Postgres and pgadmin service also in compose file for further usage. When I am running the flask app in the browser it is showing the This app is not working
docker-compose.yml file
version: '3.4'
services:
postgresql_database:
image: postgres:latest
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=productdb
ports:
- "5432:5432"
restart: always
volumes:
- database-data:/var/lib/postgresql/data/
pgadmin:
image: dpage/pgadmin4
environment:
- PGADMIN_DEFAULT_EMAIL=pgadmin4@pgadmin.org
- PGADMIN_DEFAULT_PASSWORD=admin1234
ports:
- '5050:80'
restart: always
volumes:
- pgadmin:/root/.pgadmin
web:
restart: always
depends_on:
- postgresql_database
- pgadmin
build: .
ports:
- "5000:5000"
volumes:
database-data:
pgadmin:
webapp.py
from flask import Flask,request
from psycopg2 import Error
import psycopg2
import configparser
import csv
app = Flask(__name__)
@app.route('/',methods =["GET", "POST"])
def index():
return "Clv is calculated"
if __name__ == "__main__":
app.run(debug=True)
Dockerfile
FROM python:latest
ENV LISTEN_PORT=5000
EXPOSE 5000
ADD . /code
WORKDIR /code
RUN pip install -r requirements.txt
CMD ["python","webapp.py"]
requirements.txt
flask
psycopg2
configparser
I am new to docker and flask can you help anyone to resolve this one