mercredi 22 janvier 2020

How to specify custom command in docker-compose

I'm using docker for testing my django application. I want to run custom command which runs the test cases from my django application.

Here's my docker-compose file:

version: "3"
services:
  app:
    build:
      context: .
    ports:
      - "8000:8000"
    volumes:
      - ./app:/app
    command: 
      start: sh -c "cd sms && python manage.py migrate && python manage.py runserver 0.0.0.0:8000"
      test: sh -c "cd sms && python manage.py test && flake8"

I want to run the test case using something like docker-compose run app test

Aucun commentaire:

Enregistrer un commentaire