diff --git a/Dockerfile b/Dockerfile index dcb26ea..df2ec51 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,5 +20,5 @@ EXPOSE 5000 ENV FLASK_APP=app.py ENV FLASK_ENV=production -# Command to run the application -CMD ["flask", "run", "--host=0.0.0.0"] \ No newline at end of file +# Command to run the application with gunicorn +CMD ["gunicorn", "--bind", "0.0.0.0:5000", "--workers", "4", "app:app"] \ No newline at end of file diff --git a/README.md b/README.md index 9d568f8..459d4e0 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ A Flask-based server implementation of the [SpaceAPI](https://spaceapi.io/) spec - Docker support for easy deployment - Real-time space status updates - Configurable space information (name, location, contact details, etc.) +- Production-ready with Gunicorn WSGI server ## Prerequisites @@ -76,8 +77,13 @@ curl -X POST http://localhost:5000/state \ 3. Set up environment variables and run the server: ```bash + # For development (using Flask's development server) export SPACEAPI_TOKEN=your-token-here flask run + + # For production-like environment (using Gunicorn) + export SPACEAPI_TOKEN=your-token-here + gunicorn --bind 0.0.0.0:5000 --workers 4 app:app ``` ## License diff --git a/requirements.txt b/requirements.txt index af44043..b61a793 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ flask==3.0.2 python-dotenv==1.0.1 -spaceapi==0.1.0 \ No newline at end of file +spaceapi==0.1.0 +gunicorn==21.2.0 \ No newline at end of file