Skip to content

Commit 9a37f04

Browse files
committed
docker pipfile and yaml update
1 parent 8f6a1bd commit 9a37f04

File tree

2 files changed

+25
-12
lines changed

2 files changed

+25
-12
lines changed

.github/workflows/ci-cd.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,25 @@ jobs:
3434
3535
- name: Run linting
3636
run: |
37-
black --check backend/
37+
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
38+
# In pull requests, auto-format the code
39+
black backend/
40+
isort --profile black backend/
41+
# Check if any files were changed
42+
if [[ -n "$(git status --porcelain)" ]]; then
43+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
44+
git config --local user.name "github-actions[bot]"
45+
git add .
46+
git commit -m "Apply automatic formatting"
47+
git push
48+
fi
49+
else
50+
# In other events, just check formatting
51+
black --check backend/
52+
isort --check-only --profile black backend/
53+
fi
54+
# Always run type checking and linting
3855
flake8 backend/ --config=backend/.flake8
39-
isort --check-only --profile black backend/
4056
mypy backend/ --ignore-missing-imports
4157
4258
test:

docker/Dockerfile.prod

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Multi-stage build for production Django deployment
22
# Stage 1: Build dependencies
3-
FROM python:3.11-slim as builder
3+
FROM python:3.11-slim AS builder
44

55
WORKDIR /app
66

@@ -18,23 +18,20 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
1818
&& apt-get clean \
1919
&& rm -rf /var/lib/apt/lists/*
2020

21-
# Install pipenv
22-
RUN pip install --no-cache-dir pipenv
21+
# Copy requirements file
22+
COPY requirements.txt /app/
2323

24-
# Copy Pipfile and install dependencies
25-
COPY Pipfile Pipfile.lock* /app/
26-
27-
# Install dependencies with dev dependencies excluded
28-
RUN pipenv install --system --deploy --ignore-pipfile
24+
# Install dependencies
25+
RUN pip install --no-cache-dir -r requirements.txt
2926

3027
# Stage 2: Python wheels
31-
FROM builder as wheels
28+
FROM builder AS wheels
3229

3330
# Copy the project files
3431
COPY . /app/
3532

3633
# Generate Python wheels
37-
RUN pip wheel --no-cache-dir --wheel-dir /app/wheels -r <(pipenv requirements)
34+
RUN pip wheel --no-cache-dir --wheel-dir /app/wheels -r requirements.txt
3835

3936
# Stage 3: Final lightweight runtime image
4037
FROM python:3.11-slim

0 commit comments

Comments
 (0)