Skip to content
Snippets Groups Projects
Commit 8e687a26 authored by florimondmanca's avatar florimondmanca
Browse files

fix start.sh, fix .dockerignore

parent 824b69c9
No related branches found
No related tags found
1 merge request!1Dockerize app and update TravisCI file
......@@ -3,7 +3,7 @@
.gitignore
.idea
.travis.yml
media/
./media/
README.md
LICENSE
......@@ -12,13 +12,13 @@ LICENSE
**/*.sqlite3
# Static files (will be collected inside container)
static/
./static/
# Compiled files
**/*.pyc
# Migrations
# Ignore generated migrations
oser_backend/*/migrations/*.py
**/migrations/*.py
# But keep migrations folders with their __init__.py files
!oser_backend/*/migrations/__init__.py
!**/migrations/__init__.py
sudo: required
language: python
python:
- "3.6"
services:
- docker
install:
- pip install -r requirements.txt
# Build and run the Docker images
- docker-compose up -d --build
......@@ -17,7 +11,5 @@ script:
# Check that docker images are running
- docker ps | grep nginx_01
- docker ps | grep django_01
# DEBUG: List files in Django container's WORKDIR
- docker exec django_01 ls
# Run the tests inside the Django container
- docker exec django_01 python manage.py test
......@@ -4,9 +4,12 @@ EXPOSE 8000
ADD . /oser-backend
RUN pip3 install -r oser-backend/requirements.txt
RUN pip3 install gunicorn
WORKDIR /oser-backend/oser_backend
# Debug only
RUN ls
RUN pip3 install -r ../requirements.txt
RUN pip3 install gunicorn
CMD sh ../start.sh
......@@ -6,8 +6,6 @@ services:
gunicorn:
build: .
container_name: django_01
volumes:
- .:/oser-backend/
expose:
- "8000" # port where the Django app runs
restart: on-failure
......
#!/usr/bin/env bash
# Collect static files
exec python3 manage.py collectstatic
python manage.py collectstatic
# Initialize database
exec python3 manage.py makemigrations
exec python3 manage.py migrate
python manage.py makemigrations
python manage.py migrate
# Initialize admin users
exec python3 manage.py initadmin
python manage.py initadmin
# Run server
exec gunicorn oser_backend.wsgi:application \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment