# Main docker-compose file for the project to coordinate all the docker related stuff. # To build from local image, use the `build: ...` attibute and not the `image` attribute. version: '3.7' services: # Service for the backend app. backend: # Get the image from the registry image: registry.gitlab.utc.fr/rex-dri/rex-dri/backend:latest # To use a locally build one, comment above, uncomment bellow. # build: ./backend volumes: # "Copy" the repo to the workdir. - .:/usr/src/app/ ports: # Replicate the python server port - 8000:8000 environment: # Add environment variables - ENV=DEV - SECRET_KEY=please_change_me # Django secret key # Django admin user param - DJANGO_ADMIN_USERNAME=admin - DJANGO_ADMIN_PASSWORD=admin # DB parameters - DB_HOST=database - DB_PORT=5432 - POSTGRES_DB=postgres - POSTGRES_USER=postgres - POSTGRES_PASSWORD=postgres # Run the django developpement server on image startup. command: /bin/sh -c "cd backend && ./manage.py collectstatic --noinput && ./manage.py runserver 0.0.0.0:8000" depends_on: # Required that the `database` service is up and running. - database # Service for the postgres database database: # Use of classic image image: postgres:10.5-alpine environment: # Set up the postgres ID - POSTGRES_DB=postgres - POSTGRES_USER=postgres - POSTGRES_PASSWORD=postgres volumes: # Add a volume to store the DB data. - postgres_data:/var/lib/postgresql/data/ # Service to handle frontend live developpments and building frontend: # Build image from Dockerfile build: ./frontend # On startup, start the developpement server command: /bin/sh -c "cd frontend && npm i --verbose && npm run dev" volumes: # "Copy" the repo to the workdir. - .:/usr/src/app/ ports: # Replicate the node server port. More info in ./frontend/server.js - 3000:3000 # replicate the view stats port - "8888:8888" documentation: build: ./documentation volumes: - ./documentation:/usr/src/app # Start a simple python folder command: /bin/sh -c "python -m http.server 5000" ports: # replicate the server port - "5000:5000" gen_doc_uml: # service to generate the UML of the backend image: floawfloaw/plantuml volumes: - .:/usr/src/app command: tail -F anything # keep the container alive volumes: # Create some local volume (should be stored in some directory on your computer) postgres_data: