diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..ac7aea0 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +.git/ +.github/ +.idea/ +.venv/ +shell.nix +README.md diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..657f931 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM python:3.11-slim + +WORKDIR /app + +COPY . . + +RUN pip install --no-cache-dir -r dependencies.txt + +ENV FLASK_ENV=production +ENV PYTHONUNBUFFERED=1 + +CMD ["gunicorn", "app:app", "-b", "0.0.0.0:80", "--workers", "1"] diff --git a/app.py b/app.py new file mode 100644 index 0000000..eaac9fd --- /dev/null +++ b/app.py @@ -0,0 +1,4 @@ +from flask import Flask, render_template +import os + +app = Flask(__name__) diff --git a/dependencies.txt b/dependencies.txt new file mode 100644 index 0000000..86c5d13 --- /dev/null +++ b/dependencies.txt @@ -0,0 +1,3 @@ +flask==3.1.2 +loguru +gunicorn diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..fb94cc9 --- /dev/null +++ b/shell.nix @@ -0,0 +1,25 @@ +{ pkgs ? import {} }: + +pkgs.mkShell { + buildInputs = with pkgs; [ + python3 + ruff + pyright + ]; + + shellHook = '' + if [ ! -d ".venv" ]; then + python -m venv .venv + fi + + source .venv/bin/activate + + if [ -f "requirements-dev.txt" ]; then + pip install -r requirements-dev.txt + fi + + if [ -f "dependencies.txt" ]; then + pip install -r dependencies.txt + fi + ''; +}