Skip to content

Commit c53384f

Browse files
authored
fix: docker migration volume (#12)
1 parent 59cd7b5 commit c53384f

1 file changed

Lines changed: 17 additions & 9 deletions

File tree

fastapi_forge/template/{{cookiecutter.project_name}}/docker-compose.yaml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,14 @@ services:
1111
env_file:
1212
- .env
1313
depends_on:
14-
{% if cookiecutter.use_postgres %}
14+
{%- if cookiecutter.use_postgres %}
1515
postgres:
1616
condition: service_healthy
17-
{% endif %}
17+
{%- endif %}
18+
{%- if cookiecutter.use_redis %}
19+
redis:
20+
condition: service_healthy
21+
{%- endif %}
1822
environment:
1923
{{ cookiecutter.project_name|upper|replace('-', '_') }}_RELOAD: "True"
2024
{{ cookiecutter.project_name|upper|replace('-', '_') }}_SERVER_HOST: 0.0.0.0
@@ -39,6 +43,10 @@ services:
3943
{{ cookiecutter.project_name|upper|replace('-', '_') }}_RABBITMQ_CONNECTION_POOL_SIZE: 2
4044
{{ cookiecutter.project_name|upper|replace('-', '_') }}_RABBITMQ_CHANNEL_POOL_SIZE: 10
4145
{% endif %}
46+
{%- if cookiecutter.use_alembic %}
47+
volumes:
48+
- ./migrations:/app/migrations
49+
{% endif %}
4250
develop:
4351
watch:
4452
- action: sync
@@ -47,11 +55,11 @@ services:
4755
- action: sync
4856
path: ./tests
4957
target: /app/tests
50-
{% if cookiecutter.use_alembic %}
58+
{%- if cookiecutter.use_alembic %}
5159
- action: sync
5260
path: ./migrations
5361
target: /app/migrations
54-
{% endif %}
62+
{%- endif %}
5563
- action: rebuild
5664
path: pyproject.toml
5765
- action: rebuild
@@ -74,7 +82,7 @@ services:
7482
timeout: 3s
7583
retries: 40
7684
{% endif %}
77-
{% if cookiecutter.use_redis %}
85+
{%- if cookiecutter.use_redis %}
7886
redis:
7987
image: bitnami/redis:7.4
8088
container_name: {{ cookiecutter.project_name }}-redis
@@ -92,11 +100,11 @@ services:
92100
- {{ cookiecutter.project_name }}-redis-data:/bitnami/redis/data
93101
{% endif %}
94102
volumes:
95-
{% if cookiecutter.use_postgres %}
103+
{%- if cookiecutter.use_postgres %}
96104
{{ cookiecutter.project_name }}-pg-data:
97105
name: {{ cookiecutter.project_name }}-pg-data
98-
{% endif %}
99-
{% if cookiecutter.use_redis %}
106+
{%- endif %}
107+
{%- if cookiecutter.use_redis %}
100108
{{ cookiecutter.project_name }}-redis-data:
101109
name: {{ cookiecutter.project_name }}-redis-data
102-
{% endif %}
110+
{% endif %}

0 commit comments

Comments
 (0)