Skip to content

Commit

Permalink
🍼 Ensure pip (#195)
Browse files Browse the repository at this point in the history
* Installs pip into .venv python

* Black format with new version
  • Loading branch information
mrharpo authored Feb 21, 2024
1 parent bc0dafd commit ea0c180
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
12 changes: 9 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,20 @@ CMD poetry run locust


###########################
# 'production' build stage
# 'base' build stage for production
############################
FROM base as build
RUN apt update && apt install -y gcc libpq-dev git

RUN pdm config venv.with_pip True

RUN pdm install -G production

# Install pip into the virtual environment
RUN /app/.venv/bin/python -m ensurepip

###########################
# 'production' final production image
############################
FROM python:3.11-slim as production
WORKDIR /app

Expand All @@ -76,7 +81,8 @@ COPY templates templates
COPY static static

ENV CHOWDA_ENV=production
ENV PATH=/app/.venv/bin/:$PATH
ENV PATH="/app/.venv/bin:$PATH"

EXPOSE 8000

CMD gunicorn chowda.app:app -b 0.0.0.0:8000 -w 2 --worker-class uvicorn.workers.UvicornWorker
12 changes: 6 additions & 6 deletions chowda/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,12 @@ async def serialize_value(
return [
{
**run,
'finished_at': run['finished_at'].isoformat()
if run.get('finished_at')
else None,
'created_at': run['created_at'].isoformat()
if run.get('created_at')
else None,
'finished_at': (
run['finished_at'].isoformat() if run.get('finished_at') else None
),
'created_at': (
run['created_at'].isoformat() if run.get('created_at') else None
),
}
for run in value
]
Expand Down

0 comments on commit ea0c180

Please sign in to comment.