Skip to content

Commit

Permalink
chore: improve docker files for local development (#5157)
Browse files Browse the repository at this point in the history
  • Loading branch information
fehmer authored Mar 4, 2024
1 parent ca0d6b3 commit b4af091
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 11 deletions.
4 changes: 2 additions & 2 deletions backend/docker/compose.db-only.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
image: redis:6.2.6
restart: on-failure
ports:
- "${DOCKER_REDIS_PORT:-6379}:${DOCKER_REDIS_PORT:-6379}"
- "${DOCKER_REDIS_PORT:-6379}:6379"
volumes:
- redis-data:/data

Expand All @@ -15,7 +15,7 @@ services:
image: mongo:5.0.8
restart: on-failure
ports:
- "${DOCKER_DB_PORT:-27017}:${DOCKER_DB_PORT:-27017}"
- "${DOCKER_DB_PORT:-27017}:27017"
volumes:
- mongo-data:/data/db

Expand Down
8 changes: 5 additions & 3 deletions backend/docker/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
image: redis:6.2.6
restart: on-failure
ports:
- "${DOCKER_REDIS_PORT:-6379}:${DOCKER_REDIS_PORT:-6379}"
- "${DOCKER_REDIS_PORT:-6379}:6379"
volumes:
- redis-data:/data

Expand All @@ -15,7 +15,7 @@ services:
image: mongo:5.0.8
restart: on-failure
ports:
- "${DOCKER_DB_PORT:-27017}:${DOCKER_DB_PORT:-27017}"
- "${DOCKER_DB_PORT:-27017}:27017"
volumes:
- mongo-data:/data/db

Expand All @@ -30,11 +30,13 @@ services:
- DB_URI=mongodb://mongodb:27017
- REDIS_URI=redis://redis:6379
ports:
- "${DOCKER_SERVER_PORT:-5005}:${DOCKER_SERVER_PORT:-5005}"
- "${DOCKER_SERVER_PORT:-5005}:5005"
volumes:
- be-modules:/monkeytype/backend/node_modules
- ../../:/monkeytype
entrypoint: 'bash -c "cd /monkeytype/backend && npm install && npm run dev"'

volumes:
mongo-data:
redis-data:
be-modules:
4 changes: 2 additions & 2 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"test": "jest --verbose --collect-coverage --runInBand",
"dev": "ts-node-dev ./src/server.ts -- --inspect --transpileOnly",
"knip": "knip",
"docker-db-only": "docker-compose -f docker/compose.db-only.yml up",
"docker": "docker-compose -f docker/compose.yml up"
"docker-db-only": "docker compose -f docker/compose.db-only.yml up",
"docker": "docker compose -f docker/compose.yml up"
},
"engines": {
"node": "18.19.1",
Expand Down
13 changes: 10 additions & 3 deletions frontend/docker/compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,17 @@ services:
# restart: on-failure
environment:
- SERVER_OPEN=false
- BACKEND_URL=http://localhost:${DOCKER_SERVER_PORT:-5005}
ports:
- "3000:3000"
- "${DOCKER_HTTP_PORT:-3000}:3000"
volumes:
- root-modules:/monkeytype/node_modules
- fe-modules:/monkeytype/frontend/node_modules
- ../../:/monkeytype
user: node
entrypoint: 'bash -c "cd /monkeytype/frontend && npm i && npm run dev"'
entrypoint: 'bash -c "cd /monkeytype && npm install && cd /monkeytype/frontend && npm install && npm run dev"'
# entrypoint: "tail -f /dev/null"

volumes:
root-modules:
fe-modules:

2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"dev-test": "concurrently --kill-others \"vite dev\" \"vitest\"",
"tsc": "tsc",
"knip": "knip",
"docker": "docker-compose -f docker/compose.dev.yml up"
"docker": "docker compose -f docker/compose.dev.yml up"
},
"engines": {
"node": "18.19.1",
Expand Down

0 comments on commit b4af091

Please sign in to comment.