From ad1ec854aa2e4f4ff2090e824f037b401612d05a Mon Sep 17 00:00:00 2001 From: Nano Taboada Date: Tue, 22 Apr 2025 20:02:42 -0300 Subject: [PATCH 1/2] feat: add multi-stage Dockerfile for building and running app --- Dockerfile | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f3b0c9a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,34 @@ +# Stage 1: Build +FROM python:3.12-slim-bookworm AS build + +WORKDIR /app + +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt + +COPY . . + +# Stage 2: Runtime +FROM python:3.12-slim-bookworm AS runtime + +WORKDIR /app + +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt + +COPY models ./models +COPY routes ./routes +COPY schemas ./schemas +COPY services ./services +COPY data ./data +COPY main.py . + +# Add non-root 'fastapi' user (optional for hardening) +RUN adduser --disabled-password --gecos '' fastapi \ + && chown -R fastapi:fastapi /app +USER fastapi + +EXPOSE 9000 +ENV PYTHONUNBUFFERED=1 + +CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "9000"] From e6e4563a920aee5fdb82145541a8acbc06451d17 Mon Sep 17 00:00:00 2001 From: Nano Taboada Date: Tue, 22 Apr 2025 20:03:59 -0300 Subject: [PATCH 2/2] chore(ci): add commitlint config rules --- commitlint.config.mjs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 commitlint.config.mjs diff --git a/commitlint.config.mjs b/commitlint.config.mjs new file mode 100644 index 0000000..9617c32 --- /dev/null +++ b/commitlint.config.mjs @@ -0,0 +1,16 @@ +// .commitlint.config.mjs +import conventional from '@commitlint/config-conventional'; + +export default { + ...conventional, + rules: { + 'header-max-length': [2, 'always', 80], + 'body-max-line-length': [2, 'always', 80], + }, + ignores: [ + // skip any commit whose body contains the Dependabot signature + (message) => message.includes('Signed‑off‑by: dependabot[bot]'), + // skip any Dependabot‑style bump header + (message) => /^chore\(deps(-dev)?\): bump /.test(message), + ], +};