Split the docs from local.yml and build the service in CI

This commit is contained in:
Shayan Karimi 2024-03-08 10:36:01 +03:30
parent b27fd26b78
commit 3ebcaf9be4
7 changed files with 29 additions and 15 deletions

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View 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

View File

@ -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: