diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..26e5c2b --- /dev/null +++ b/.dockerignore @@ -0,0 +1,10 @@ +__pycache__/ +*.pyc +*.pyo +*.pyd +.env +node_modules/ +.git +.gitignore +windsurfrules +Input/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6df7beb --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +# Use official Python image +FROM python:3.11-slim + +WORKDIR /app + +COPY requirements.txt ./ +RUN pip install --no-cache-dir -r requirements.txt + +COPY . . + +EXPOSE 5000 +CMD ["python", "app.py"] diff --git a/README.md b/README.md index 8a1793f..7d4cb4f 100644 --- a/README.md +++ b/README.md @@ -1 +1,20 @@ -A simple, editable attendance table with dates as rows and player names (plus guest) as columns. Users can mark their attendance with a click. No login, no user management, just a fast and easy attendance tracker. \ No newline at end of file +## Sport Attendance Sheet + +A simple, editable attendance table with dates as rows and player names (plus guest) as columns. Users can mark their attendance with a click. No login, no user management, just a fast and easy attendance tracker. + +### Deploying to Coolify (Docker) + +1. **Build and push the Docker image** (or connect your repo to Coolify): + - If using Git: Push this repo to your Git provider and connect it in Coolify. + - If building locally: + ```sh + docker build -t yourusername/sport-attendance-sheet . + docker run -p 5000:5000 yourusername/sport-attendance-sheet + ``` +2. **Create a new Docker app in Coolify** + - Set the port to `5000`. + - Ensure persistent storage for `attendance_data.json` if you want data to survive redeploys. + - Set environment variable `PORT=5000` if needed. + +3. **Access your app** + - Once deployed, your app will be available at the URL Coolify provides. \ No newline at end of file diff --git a/app.py b/app.py index a7ff33f..e74d51b 100644 --- a/app.py +++ b/app.py @@ -43,4 +43,6 @@ def update_data(): return jsonify({"status": "success"}) if __name__ == '__main__': - app.run(debug=True) + import os + port = int(os.environ.get('PORT', 5000)) + app.run(host='0.0.0.0', port=port, debug=False)