diff --git a/dockerfile b/dockerfile index 22d952d..1ab4644 100644 --- a/dockerfile +++ b/dockerfile @@ -8,12 +8,16 @@ COPY requirements.txt . # Install the required packages RUN pip install --no-cache-dir -r requirements.txt +RUN pip install gunicorn # Copy the rest of the application code into the container -COPY src src +COPY src . # Expose the port the app runs on EXPOSE 5000 +# Set environment variables +ENV FLASK_APP=main.py + # run the application -CMD ["python", "src/main.py"] \ No newline at end of file +ENTRYPOINT [ "gunicorn", "-b", ":5000", "--access-logfile", "-", "--error-logfile", "-", "main:app" ] \ No newline at end of file diff --git a/src/main.py b/src/main.py index 26ce819..ce9ba96 100644 --- a/src/main.py +++ b/src/main.py @@ -63,6 +63,8 @@ except: # Configure utils log.info("Configuring utils") conv = utils.data_converter(db) +log.info("Configuration complete") + # Define routes @@ -718,4 +720,9 @@ def error(error_message): # Run the app if __name__ == '__main__': - pass \ No newline at end of file + log.info("Starting development server") + app.run( + host=env('HOST', default='0.0.0.0'), + port=env('PORT', default=5000), + debug=env('DEBUG', default=True) + ) \ No newline at end of file