Skip to content

Commit

Permalink
Add entrypoint script
Browse files Browse the repository at this point in the history
The entrypoint script runs migrations
  • Loading branch information
laurigates committed Oct 17, 2023
1 parent dd984c4 commit 9f05166
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*
!mittaridatapumppu-deviceregistry
!requirements.txt
!entrypoint.sh
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ ENV DJANGO_DB_PORT=5432
ENV MEDIA_ROOT=/media
ENV DJANGO_SETTINGS_MODULE=deviceregistry.settings

COPY entrypoint.sh /

# Install GeoDjango dependencies and binutils to help Django find them
RUN apk add --no-cache \
geos-dev \
Expand All @@ -44,5 +46,6 @@ RUN chgrp -R 0 /home/app && \

USER app

ENTRYPOINT ["/entrypoint.sh"]
CMD ["uvicorn", "deviceregistry.asgi:application", "--host", "0.0.0.0", "--port", "8000", "--proxy-headers", "--lifespan", "off"]
EXPOSE 8000/tcp
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,8 @@ The following repositories contain the services for the data pipeline shown in d

# Build and Test
Go To [test set up](tests/README.md)

```
pip-compile
pip-compile --extra dev --output-file requirements-dev.txt
```
4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,13 @@ services:
DJANGO_DB_PORT:
# Debug config
DEBUG: 1
# UVICORN_RELOAD: true
# UVICORN_LOG_LEVEL: true
depends_on:
- db

db:
image: postgres
image: postgis/postgis:16-3.4
ports:
- "5432:5432"
environment:
Expand Down
4 changes: 4 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
python manage.py migrate

exec "$@"

0 comments on commit 9f05166

Please sign in to comment.