mirror of
https://github.com/farcasterxyz/hub-monorepo.git
synced 2026-04-18 03:00:22 -04:00
Instead of requiring the user to run `yarn install` followed by `yarn start`, we simply have them run `docker compose up` to start both the app and Postgres together. This is much easier and reduces the need for them to install anything else besides Docker. It also makes cleaning up the example easier.
45 lines
967 B
YAML
45 lines
967 B
YAML
version: '3.9'
|
|
|
|
services:
|
|
app:
|
|
image: 'node:20-alpine'
|
|
restart: unless-stopped
|
|
command: ["sh", "-c", "yarn install && exec yarn start"]
|
|
init: true
|
|
environment:
|
|
- POSTGRES_URL=postgres://app:password@postgres:5432/hub
|
|
volumes:
|
|
- .:/home/node/app
|
|
- app_node_modules:/home/node/app/node_modules
|
|
working_dir: /home/node/app
|
|
depends_on:
|
|
- postgres
|
|
networks:
|
|
- my_network
|
|
|
|
postgres:
|
|
image: 'postgres:15-alpine'
|
|
restart: unless-stopped
|
|
ports:
|
|
- '6541:5432' # Use a port unlikely to be in use so the example "Just Works"
|
|
environment:
|
|
- POSTGRES_DB=hub
|
|
- POSTGRES_USER=app
|
|
- POSTGRES_PASSWORD=password
|
|
volumes:
|
|
- pgdata:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ['CMD-SHELL', 'pg_isready']
|
|
interval: 10s
|
|
timeout: 10s
|
|
retries: 3
|
|
networks:
|
|
- my_network
|
|
|
|
volumes:
|
|
pgdata:
|
|
app_node_modules:
|
|
|
|
networks:
|
|
my_network:
|