Download Dockerfile from Oranblock/Pomodoro: direct link, hf CLI and curl.
- Browser
- Download file 2.23 kB
-
https://huggingface.co/spaces/Oranblock/Pomodoro/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/Oranblock/Pomodoro/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/Oranblock/Pomodoro/resolve/main/Dockerfile
2.23 kB
| # Use an official Python runtime as a parent image | |
| FROM python:3.9 | |
| # Create a user to run the app | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| # Set the working directory in the container | |
| WORKDIR /app | |
| # Copy the requirements file and install dependencies | |
| COPY --chown=user ./requirements.txt requirements.txt | |
| RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
| # Copy the current directory contents into the container at /app | |
| COPY --chown=user . /app | |
| # Initialize the database | |
| RUN python - <<EOF | |
| import sqlite3 | |
| conn = sqlite3.connect('/app/database.db') | |
| cursor = conn.cursor() | |
| cursor.execute(''' | |
| CREATE TABLE IF NOT EXISTS sessions ( | |
| id INTEGER PRIMARY KEY AUTOINCREMENT, | |
| user_id INTEGER, | |
| start_time TEXT, | |
| end_time TEXT, | |
| script_code TEXT, | |
| rating INTEGER, | |
| comments TEXT, | |
| session_type TEXT, | |
| duration INTEGER | |
| ) | |
| ''') | |
| cursor.execute(''' | |
| CREATE TABLE IF NOT EXISTS users ( | |
| id INTEGER PRIMARY KEY AUTOINCREMENT, | |
| username TEXT UNIQUE, | |
| password TEXT, | |
| is_admin INTEGER DEFAULT 0 | |
| ) | |
| ''') | |
| cursor.execute(''' | |
| CREATE TABLE IF NOT EXISTS tasks ( | |
| id INTEGER PRIMARY KEY AUTOINCREMENT, | |
| user_id INTEGER, | |
| description TEXT, | |
| completed INTEGER DEFAULT 0 | |
| ) | |
| ''') | |
| cursor.execute(''' | |
| CREATE TABLE IF NOT EXISTS settings ( | |
| id INTEGER PRIMARY KEY AUTOINCREMENT, | |
| user_id INTEGER, | |
| setting_name TEXT, | |
| setting_value TEXT, | |
| UNIQUE(user_id, setting_name) | |
| ) | |
| ''') | |
| cursor.execute(''' | |
| CREATE TABLE IF NOT EXISTS admin_settings ( | |
| setting_name TEXT PRIMARY KEY, | |
| setting_value INTEGER | |
| ) | |
| ''') | |
| default_settings = [ | |
| ('sound_enabled', 1), | |
| ('notifications_enabled', 1), | |
| ('dark_mode_enabled', 1), | |
| ('task_manager_enabled', 1), | |
| ('statistics_enabled', 1) | |
| ] | |
| cursor.executemany('INSERT OR IGNORE INTO admin_settings (setting_name, setting_value) VALUES (?, ?)', default_settings) | |
| conn.commit() | |
| conn.close() | |
| EOF | |
| # Make port 7860 available to the world outside this container | |
| EXPOSE 7860 | |
| # Run app.py when the container launches | |
| CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:7860", "app:app"] |