Skip to content

Commit 4fea1ed

Browse files
authored
Merge pull request #342 from nanotaboada/feature/dockerfile
feat: add multi-stage Dockerfile for building and running app
2 parents 5e194dd + e6e4563 commit 4fea1ed

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

Dockerfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Stage 1: Build
2+
FROM python:3.12-slim-bookworm AS build
3+
4+
WORKDIR /app
5+
6+
COPY requirements.txt .
7+
RUN pip install --no-cache-dir -r requirements.txt
8+
9+
COPY . .
10+
11+
# Stage 2: Runtime
12+
FROM python:3.12-slim-bookworm AS runtime
13+
14+
WORKDIR /app
15+
16+
COPY requirements.txt .
17+
RUN pip install --no-cache-dir -r requirements.txt
18+
19+
COPY models ./models
20+
COPY routes ./routes
21+
COPY schemas ./schemas
22+
COPY services ./services
23+
COPY data ./data
24+
COPY main.py .
25+
26+
# Add non-root 'fastapi' user (optional for hardening)
27+
RUN adduser --disabled-password --gecos '' fastapi \
28+
&& chown -R fastapi:fastapi /app
29+
USER fastapi
30+
31+
EXPOSE 9000
32+
ENV PYTHONUNBUFFERED=1
33+
34+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "9000"]

commitlint.config.mjs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// .commitlint.config.mjs
2+
import conventional from '@commitlint/config-conventional';
3+
4+
export default {
5+
...conventional,
6+
rules: {
7+
'header-max-length': [2, 'always', 80],
8+
'body-max-line-length': [2, 'always', 80],
9+
},
10+
ignores: [
11+
// skip any commit whose body contains the Dependabot signature
12+
(message) => message.includes('Signed‑off‑by: dependabot[bot]'),
13+
// skip any Dependabot‑style bump header
14+
(message) => /^chore\(deps(-dev)?\): bump /.test(message),
15+
],
16+
};

0 commit comments

Comments
 (0)