Skip to content

Commit

Permalink
Fix entrypoint problem & change dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
erfanloghmani committed Apr 30, 2020
1 parent 6ac39b5 commit 0370615
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 22 deletions.
26 changes: 7 additions & 19 deletions Dockerfile.prod
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,24 @@ FROM python:3.7.4-alpine
# set work directory
WORKDIR /usr/src/app


RUN apk add --no-cache --virtual .build-deps gcc musl-dev

# install python-dev
RUN apk update \
&& apk add --virtual .build-deps gcc libc-dev libxslt-dev \
&& apk add --no-cache libxslt

# install psycopg2
# install psycopg2 dependencies
RUN apk update \
&& apk add --virtual build-deps gcc python3-dev musl-dev \
&& apk add postgresql-dev \
&& pip install psycopg2 \
&& apk del build-deps \
&& pip install django-heroku

# install zlib for pillow
# RUN apk add --no-cache jpeg-dev zlib-dev
&& apk add postgresql-dev

# install dependencies
RUN pip install --upgrade pipenv
RUN pip install --upgrade pip pipenv

COPY ./Pipfile /usr/src/app/Pipfile
COPY ./Pipfile.lock /usr/src/app/Pipfile.lock

# copy entrypoint-prod.sh
COPY ./entrypoint.prod.sh /usr/src/app/entrypoint.prod.sh


RUN pipenv install

# copy project
COPY . /usr/src/app/
RUN pipenv install


#psycopg2 django-heroku django-import-export
Expand Down
6 changes: 3 additions & 3 deletions entrypoint.prod.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
pipenv shell

if [ "$DATABASE" = "postgres" ]
then
echo "Waiting for postgres..."
Expand All @@ -11,7 +11,7 @@ then
echo "PostgreSQL started"
fi

python manage.py migrate
python manage.py collectstatic --no-input --clear
pipenv run python manage.py migrate
pipenv run python manage.py collectstatic --no-input --clear

exec "$@"

0 comments on commit 0370615

Please sign in to comment.