Skip to content

Commit 3d56ef8

Browse files
Added external to volume for pg db.
1 parent 4d1a020 commit 3d56ef8

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,5 @@ EXPOSE 4000
6464
# Run migrations then start
6565
ENTRYPOINT ["./docker-entrypoint.sh"]
6666

67-
# The default command for the entrypoint script
68-
CMD ["pnpm", "start"]
67+
# The default command for the entrypoint script: run production build
68+
CMD ["pnpm", "start:prod"]

docker-compose.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ services:
1818
container_name: codebuilder-redis
1919
restart: unless-stopped
2020
ports:
21-
- "6379:6379"
21+
- "6376:6379"
2222
networks:
2323
- codebuilder-net
2424

@@ -52,6 +52,8 @@ services:
5252

5353
volumes:
5454
postgres-data:
55+
external: true
56+
name: codebuilder-postgres-data
5557

5658

5759
networks:

docker-entrypoint.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,11 @@ echo -e "${GREEN}✅ Migrations complete.${NC}"
4444

4545
echo -e "${BLUE}🚀 Starting NestJS application...${NC}"
4646

47-
# Now, execute the main command provided to the container (e.g., "pnpm start").
47+
# Before executing, if no command is provided, default to production start
48+
if [ "$#" -eq 0 ]; then
49+
echo "[ENTRYPOINT] No command provided, defaulting to pnpm start:prod"
50+
set -- pnpm start:prod
51+
fi
4852
# 'exec "$@"' replaces the shell process with the given command,
4953
# ensuring it becomes the main process (PID 1) and receives signals correctly.
5054
exec "$@"

0 commit comments

Comments
 (0)