mirror of
				https://github.com/cookiecutter/cookiecutter-django.git
				synced 2025-11-04 09:57:30 +03:00 
			
		
		
		
	Split the docs from local.yml and build the service in CI (#4909)
* Split the docs from local.yml and build the service in CI * Change docs build in our CI docker tests
This commit is contained in:
		
							parent
							
								
									5c71441c9b
								
							
						
					
					
						commit
						a1d34a08af
					
				| 
						 | 
					@ -65,6 +65,13 @@ To run in a detached (background) mode, just::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $ docker compose up -d
 | 
					    $ docker compose up -d
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					These commands don't run the docs service. In order to run docs service you can run::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    $ docker compose -f docs.yml up
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					To run the docs with local services just use::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    $ docker compose -f local.yml -f docs.yml up
 | 
				
			||||||
 | 
					
 | 
				
			||||||
The site should start and be accessible at http://localhost:3000 if you selected Webpack or Gulp as frontend pipeline and http://localhost:8000 otherwise.
 | 
					The site should start and be accessible at http://localhost:3000 if you selected Webpack or Gulp as frontend pipeline and http://localhost:8000 otherwise.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -43,7 +43,7 @@ docker compose -f local.yml run \
 | 
				
			||||||
  django python manage.py check --settings=config.settings.production --deploy --database default --fail-level WARNING
 | 
					  django python manage.py check --settings=config.settings.production --deploy --database default --fail-level WARNING
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Generate the HTML for the documentation
 | 
					# Generate the HTML for the documentation
 | 
				
			||||||
docker compose -f local.yml run docs make html
 | 
					docker compose -f docs.yml run docs make html
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Run npm build script if package.json is present
 | 
					# Run npm build script if package.json is present
 | 
				
			||||||
if [ -f "package.json" ]
 | 
					if [ -f "package.json" ]
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -32,6 +32,7 @@ steps:
 | 
				
			||||||
    DATABASE_URL: pgsql://$POSTGRES_USER:$POSTGRES_PASSWORD@postgres/$POSTGRES_DB
 | 
					    DATABASE_URL: pgsql://$POSTGRES_USER:$POSTGRES_PASSWORD@postgres/$POSTGRES_DB
 | 
				
			||||||
  commands:
 | 
					  commands:
 | 
				
			||||||
  - docker-compose -f local.yml build
 | 
					  - docker-compose -f local.yml build
 | 
				
			||||||
 | 
					  - docker-compose -f docs.yml build
 | 
				
			||||||
  - docker-compose -f local.yml run --rm django python manage.py migrate
 | 
					  - docker-compose -f local.yml run --rm django python manage.py migrate
 | 
				
			||||||
  - docker-compose -f local.yml up -d
 | 
					  - docker-compose -f local.yml up -d
 | 
				
			||||||
  - docker-compose -f local.yml run django pytest
 | 
					  - docker-compose -f local.yml run django pytest
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -70,6 +70,7 @@ jobs:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      - name: Build the Stack
 | 
					      - name: Build the Stack
 | 
				
			||||||
        run: docker compose -f local.yml build django
 | 
					        run: docker compose -f local.yml build django
 | 
				
			||||||
 | 
					        run: docker compose -f local.yml build docs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      - name: Run DB Migrations
 | 
					      - name: Run DB Migrations
 | 
				
			||||||
        run: docker compose -f local.yml run --rm django python manage.py migrate
 | 
					        run: docker compose -f local.yml run --rm django python manage.py migrate
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -34,6 +34,7 @@ pytest:
 | 
				
			||||||
    - docker:dind
 | 
					    - docker:dind
 | 
				
			||||||
  before_script:
 | 
					  before_script:
 | 
				
			||||||
    - docker compose -f local.yml build
 | 
					    - docker compose -f local.yml build
 | 
				
			||||||
 | 
					    - docker compose -f docs.yml build
 | 
				
			||||||
    # Ensure celerybeat does not crash due to non-existent tables
 | 
					    # Ensure celerybeat does not crash due to non-existent tables
 | 
				
			||||||
    - docker compose -f local.yml run --rm django python manage.py migrate
 | 
					    - docker compose -f local.yml run --rm django python manage.py migrate
 | 
				
			||||||
    - docker compose -f local.yml up -d
 | 
					    - docker compose -f local.yml up -d
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,6 +20,7 @@ jobs:
 | 
				
			||||||
        - docker compose -v
 | 
					        - docker compose -v
 | 
				
			||||||
        - docker -v
 | 
					        - docker -v
 | 
				
			||||||
        - docker compose -f local.yml build
 | 
					        - docker compose -f local.yml build
 | 
				
			||||||
 | 
					        - docker compose -f docs.yml build
 | 
				
			||||||
        # Ensure celerybeat does not crash due to non-existent tables
 | 
					        # Ensure celerybeat does not crash due to non-existent tables
 | 
				
			||||||
        - docker compose -f local.yml run --rm django python manage.py migrate
 | 
					        - docker compose -f local.yml run --rm django python manage.py migrate
 | 
				
			||||||
        - docker compose -f local.yml up -d
 | 
					        - docker compose -f local.yml up -d
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										18
									
								
								{{cookiecutter.project_slug}}/docs.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								{{cookiecutter.project_slug}}/docs.yml
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,18 @@
 | 
				
			||||||
 | 
					version: '3'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					services:
 | 
				
			||||||
 | 
					  docs:
 | 
				
			||||||
 | 
					    image: {{ cookiecutter.project_slug }}_local_docs
 | 
				
			||||||
 | 
					    container_name: {{ cookiecutter.project_slug }}_local_docs
 | 
				
			||||||
 | 
					    build:
 | 
				
			||||||
 | 
					      context: .
 | 
				
			||||||
 | 
					      dockerfile: ./compose/local/docs/Dockerfile
 | 
				
			||||||
 | 
					    env_file:
 | 
				
			||||||
 | 
					      - ./.envs/.local/.django
 | 
				
			||||||
 | 
					    volumes:
 | 
				
			||||||
 | 
					      - ./docs:/docs:z
 | 
				
			||||||
 | 
					      - ./config:/app/config:z
 | 
				
			||||||
 | 
					      - ./{{ cookiecutter.project_slug }}:/app/{{ cookiecutter.project_slug }}:z
 | 
				
			||||||
 | 
					    ports:
 | 
				
			||||||
 | 
					      - '9000:9000'
 | 
				
			||||||
 | 
					    command: /start-docs
 | 
				
			||||||
| 
						 | 
					@ -40,21 +40,6 @@ services:
 | 
				
			||||||
    env_file:
 | 
					    env_file:
 | 
				
			||||||
      - ./.envs/.local/.postgres
 | 
					      - ./.envs/.local/.postgres
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  docs:
 | 
					 | 
				
			||||||
    image: {{ cookiecutter.project_slug }}_local_docs
 | 
					 | 
				
			||||||
    container_name: {{ cookiecutter.project_slug }}_local_docs
 | 
					 | 
				
			||||||
    build:
 | 
					 | 
				
			||||||
      context: .
 | 
					 | 
				
			||||||
      dockerfile: ./compose/local/docs/Dockerfile
 | 
					 | 
				
			||||||
    env_file:
 | 
					 | 
				
			||||||
      - ./.envs/.local/.django
 | 
					 | 
				
			||||||
    volumes:
 | 
					 | 
				
			||||||
      - ./docs:/docs:z
 | 
					 | 
				
			||||||
      - ./config:/app/config:z
 | 
					 | 
				
			||||||
      - ./{{ cookiecutter.project_slug }}:/app/{{ cookiecutter.project_slug }}:z
 | 
					 | 
				
			||||||
    ports:
 | 
					 | 
				
			||||||
      - '9000:9000'
 | 
					 | 
				
			||||||
    command: /start-docs
 | 
					 | 
				
			||||||
  {%- if cookiecutter.use_mailpit == 'y' %}
 | 
					  {%- if cookiecutter.use_mailpit == 'y' %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  mailpit:
 | 
					  mailpit:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user