Skip to content

Commit

Permalink
Refine docker-compose.yml:
Browse files Browse the repository at this point in the history
1. use short volume bind syntax.
2. fix postgres volume issue.
   check luckyframework#798.
3. Add POSTGRES_DB env for clarify,
   check luckyframework/lucky#1791 (reply in thread)
4. Add crystal build cache into volume for better performance.
  • Loading branch information
zw963 committed Apr 23, 2023
1 parent 7c3c69c commit ed43045
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions src/web_app_skeleton/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '3.8'
version: "3.8"
services:
lucky:
build:
Expand All @@ -8,15 +8,10 @@ services:
DATABASE_URL: postgres://lucky:password@postgres:5432/lucky
DEV_HOST: "0.0.0.0"
volumes:
- type: bind
source: .
target: /app
- type: volume
source: node_modules
target: /app/node_modules
- type: volume
source: shards_lib
target: /app/lib
- .:/app
- node_modules:/app/node_modules
- shards_lib:/app/lib
- build_cache:/root/.cache/crystal
depends_on:
- postgres
ports:
Expand All @@ -30,10 +25,9 @@ services:
environment:
POSTGRES_USER: lucky
POSTGRES_PASSWORD: password
POSTGRES_DB: lucky
volumes:
- type: volume
source: postgres_data
target: /var/lib/postgresql
- postgres_data:/var/lib/postgresql/data
ports:
# The postgres database container is exposed on the host at port 6543 to
# allow connecting directly to it with postgres clients. The port differs
Expand All @@ -46,3 +40,4 @@ volumes:
postgres_data:
node_modules:
shards_lib:
build_cache:

0 comments on commit ed43045

Please sign in to comment.