Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.git
.github
.idea
**/__pycache__
**/.mypy_cache
.pytest_cache
.coverage
generation
test
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
python-version: "3.15"

- name: Install dependencies
run: pip install -r requirements.txt
run: pip install -r requirements-dev.txt

- name: Run tests
run: pytest
Expand All @@ -34,7 +34,7 @@ jobs:
python-version: "3.15"

- name: Install dependencies
run: pip install -r requirements.txt
run: pip install -r requirements-dev.txt

- name: Run pylint
run: pylint src --rcfile=.pylintrc --fail-under=9.5
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
/generation
__pycache__/
.python-version
.coverage
27 changes: 8 additions & 19 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,19 @@
# Use Python 3.11 as the base image
FROM python:3.15-slim

# Install Tkinter dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
python3-tk \
tk-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Set the working directory
WORKDIR /app

# Copy requirements.txt first to leverage Docker cache
# Install the runtime dependencies first to leverage the Docker cache
COPY requirements.txt .

# Install project dependencies
RUN pip install --no-cache-dir -r requirements.txt
RUN pip install --no-cache-dir uvicorn

# Now copy **everything** from the project root into /app
COPY . /app
# The API only needs the source code
COPY src ./src

# Run the application as an unprivileged user
RUN useradd --create-home --uid 1000 app
USER app

# Expose the port that FastAPI will run on
EXPOSE 8000

ENV PYTHONPATH=/app/src

# Command to run the application
CMD ["python", "-m", "uvicorn", "src.controller:app", "--host", "0.0.0.0", "--port", "8000"]
CMD ["python", "-m", "uvicorn", "controller:app", "--app-dir", "src", "--host", "0.0.0.0", "--port", "8000"]
7 changes: 7 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-r requirements.txt
black~=26.10.1
pylint~=4.1.3
flake8~=7.5.0
mypy~=2.4.0
pytest~=9.1.1
httpx~=0.28.1
8 changes: 1 addition & 7 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
numpy~=2.5.1
fastapi~=0.162.0
starlette~=1.10.0
black~=26.10.1
pylint~=4.1.3
flake8~=7.5.0
mypy~=2.4.0
pillow~=13.0.0
pytest~=9.1.1
httpx~=0.28.1
uvicorn~=0.54.0
3 changes: 1 addition & 2 deletions src/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

import secrets

from fastapi import FastAPI, Path
from starlette.responses import Response
from fastapi import FastAPI, Path, Response
from fastapi.middleware.cors import CORSMiddleware

from utils import globals as my_globals
Expand Down
Loading