Skip to content

Commit

Permalink
Use pipenv without --system
Browse files Browse the repository at this point in the history
New best practice, see: pypa/pipenv#2762
  • Loading branch information
ferndot committed May 20, 2019
1 parent 430cdf3 commit 5e3acc8
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 25 deletions.
9 changes: 4 additions & 5 deletions {{ cookiecutter.project_slug }}/Dockerfile.heroku
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
FROM python:3-alpine
ENV PYTHONUNBUFFERED 1

# Add system dependencies
# Add dependencies
RUN apk update && apk add postgresql-dev gcc python3-dev musl-dev libffi-dev make

# Allows docker to cache installed dependencies between builds
COPY Pipfile* ./
RUN pip install pipenv
RUN pipenv install --system --deploy --ignore-pipfile

# Adds our application code to the image
COPY . /code/
WORKDIR /code

# Install dependencies
RUN pipenv install --deploy --ignore-pipfile

# Expose Django's port
EXPOSE $PORT
9 changes: 4 additions & 5 deletions {{ cookiecutter.project_slug }}/Dockerfile.local
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
FROM python:3-alpine
ENV PYTHONUNBUFFERED 1

# Add system dependencies
# Add dependencies
RUN apk update && apk add postgresql-dev gcc python3-dev musl-dev libffi-dev make

# Allows docker to cache installed dependencies between builds
COPY Pipfile* ./
RUN pip install pipenv
RUN pipenv install --dev --system --deploy --ignore-pipfile

# Adds our application code to the image
COPY . /code/
WORKDIR /code

# Install dependencies
RUN pipenv install --deploy --ignore-pipfile --dev

# Expose Django's port
EXPOSE $PORT
6 changes: 3 additions & 3 deletions {{ cookiecutter.project_slug }}/scripts/heroku/deploy_web.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash
python manage.py migrate
python manage.py collectstatic --noinput
#!/bin/sh
pipenv run python manage.py migrate
pipenv run python manage.py collectstatic --noinput
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/sh
celery -A config.celery worker -l info
pipenv run celery -A config.celery worker -l info
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/sh
celery -A config.celery beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler
pipenv run celery -A config.celery beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler
2 changes: 1 addition & 1 deletion {{ cookiecutter.project_slug }}/scripts/heroku/run_web.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/sh
gunicorn config.wsgi:application -b 0.0.0.0:${PORT} -k config.server.production.ProductionUvicornWorker --access-logfile -
pipenv run gunicorn config.wsgi:application -b 0.0.0.0:${PORT} -k config.server.production.ProductionUvicornWorker --access-logfile -
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/sh
watchmedo auto-restart --patterns="*.py" -d api -- celery -A config.celery worker -l info
pipenv run watchmedo auto-restart --patterns="*.py" -d api -- celery -A config.celery worker -l info
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/sh
watchmedo auto-restart --patterns="*.py" -d api -- celery -A config.celery beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler
pipenv run watchmedo auto-restart --patterns="*.py" -d api -- celery -A config.celery beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler
6 changes: 3 additions & 3 deletions {{ cookiecutter.project_slug }}/scripts/local/run_web.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
python scripts/local/wait_for_postgres.py
python manage.py migrate
python manage.py runserver 0.0.0.0:8000
pipenv run python scripts/local/wait_for_postgres.py
pipenv run python manage.py migrate
pipenv run python manage.py runserver 0.0.0.0:8000
9 changes: 5 additions & 4 deletions {{ cookiecutter.project_slug }}/scripts/travis/run_tests.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/sh
flake8 . &&
black --check . &&
python scripts/local/wait_for_postgres.py &&
pytest --cov=./
pipenv run \
flake8 . &&
black --check . &&
python scripts/local/wait_for_postgres.py &&
pytest --cov=./

0 comments on commit 5e3acc8

Please sign in to comment.