Skip to content

Commit d09fd80

Browse files
committed
Changed Docker file
1 parent fa6ee28 commit d09fd80

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

.dockerignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
/.git/
44
__pycache__/
55

6-
/data/
6+
/data/pgdata
77
/scripts/
88
/static/
99

1010
/.dockerignore
1111
/.gitignore
1212
/docker-compose.yml
1313
/Dockerfile
14-
/Pipfile.lock
14+
/Pipfile
1515
/Procfile
1616
/Makefile

Dockerfile

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,23 @@ ENV DEBUG False
55

66
WORKDIR /app/
77

8-
COPY Pipfile /app/Pipfile
9-
RUN pip install --upgrade pipenv && pipenv install
8+
# Install dependencies
9+
COPY Pipfile.lock ./
10+
RUN pip install --upgrade pipenv \
11+
&& pipenv requirements > requirements.txt \
12+
&& pip install -r requirements.txt \
13+
&& pip uninstall -y pipenv \
14+
&& rm Pipfile.lock requirements.txt \
15+
&& mkdir data
1016

17+
# Copy source files
1118
COPY . /app/
12-
RUN pipenv run ./manage.py collectstatic
19+
RUN ./manage.py collectstatic
20+
21+
# Add user
22+
RUN useradd user
23+
USER user
1324

1425
EXPOSE 8000
15-
ENTRYPOINT pipenv run ./manage.py migrate \
16-
&& pipenv run gunicorn app.wsgi:application --bind 0.0.0.0:8000 --workers 1
26+
ENTRYPOINT ./manage.py migrate \
27+
&& gunicorn app.wsgi:application --bind 0.0.0.0:8000 --workers 1

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ dumpdata:
2121
loaddata:
2222
@echo "=== Restoring $(PROD_DB_URL) ==="
2323
@pipenv run ./manage.py flush
24-
@pipenv run ./manage.py loaddata $(BACKUP_JSON_FILE)
24+
@pipenv run ./manage.py loaddata $(BACKUP_JSON_FILE) -e contenttypes.contenttype -e auth.permission -e admin
2525

2626
## pg_dump
2727

0 commit comments

Comments
 (0)