Containerization!
This commit is contained in:
parent
ef362a26cc
commit
a501ac5e36
2 changed files with 25 additions and 0 deletions
24
Containerfile
Normal file
24
Containerfile
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
FROM python:3.11-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy requirements and install Python dependencies
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Copy application files
|
||||
COPY app.py .
|
||||
COPY templates/ templates/
|
||||
COPY static/ static/
|
||||
|
||||
# Initialize database with 14 users.
|
||||
RUN python3 -c "import sqlite3; \
|
||||
conn = sqlite3.connect('database.db'); \
|
||||
conn.execute('CREATE TABLE players (id INTEGER PRIMARY KEY, name TEXT DEFAULT \"\", score INTEGER DEFAULT 0)'); \
|
||||
[conn.execute('INSERT INTO players VALUES (?, ?, 0)', (i, f'Player {i}')) for i in range(1, 15)]; \
|
||||
conn.commit(); \
|
||||
conn.close()"
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
CMD ["python", "app.py"]
|
||||
1
requirements.txt
Normal file
1
requirements.txt
Normal file
|
|
@ -0,0 +1 @@
|
|||
Flask==3.0.0
|
||||
Loading…
Reference in a new issue