Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DOCKER.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ Build and run locally:

```bash
docker build -f docker/Dockerfile -t prompts.chat .
docker run -p 4444:3000 -v prompts-data:/data prompts.chat
docker run --name prompts_library -p 4444:3000 -v prompts-data:/data prompts.chat
Comment thread
B4rakH marked this conversation as resolved.
```

## Health Check
Expand Down
3 changes: 2 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ RUN mkdir -p /data/postgres /data/app && chown -R postgres:postgres /data/postgr
# Copy bootstrap scripts
COPY docker/bootstrap.sh /bootstrap.sh
COPY docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
RUN chmod +x /bootstrap.sh
# Fix Windows CRLF so /bootstrap.sh can run in Linux containers.
RUN sed -i 's/\r$//' /bootstrap.sh && chmod +x /bootstrap.sh

# Environment defaults
ENV NODE_ENV=production
Expand Down
8 changes: 6 additions & 2 deletions docker/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ fi
# Wait for supervisord socket to be ready
echo "▶ Waiting for supervisord..."
for i in $(seq 1 30); do
if supervisorctl -c /etc/supervisor/conf.d/supervisord.conf status >/dev/null 2>&1; then
# nextjs starts later, so only check the postgres program here.
if supervisorctl -c /etc/supervisor/conf.d/supervisord.conf status postgresql | grep -q "RUNNING"; then
echo "✓ Supervisord is ready"
break
fi
Expand All @@ -164,12 +165,15 @@ done
echo "▶ Starting Next.js..."
supervisorctl -c /etc/supervisor/conf.d/supervisord.conf start nextjs

# Display host port first (for using in browser) when provided (for -p host:container mappings).
DISPLAY_PORT="${HOST_PORT:-${PORT:-80}}"

echo ""
echo "╔═══════════════════════════════════════════════════════════════╗"
echo "║ ║"
echo "║ ✅ prompts.chat is running! ║"
echo "║ ║"
echo "║ 🌐 Open http://localhost:${PORT:-80} in your browser ║"
echo "║ 🌐 Open http://localhost:${DISPLAY_PORT} in your browser ║"
Comment thread
B4rakH marked this conversation as resolved.
echo "║ ║"
echo "╚═══════════════════════════════════════════════════════════════╝"
echo ""
Expand Down
13 changes: 13 additions & 0 deletions docker/supervisord.conf
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
# Local socket used by supervisorctl.
[unix_http_server]
file=/tmp/supervisor.sock
chmod=0700

[supervisord]
nodaemon=true
user=root
logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid
childlogdir=/var/log/supervisor

# Required RPC interface for supervisorctl commands.
[rpcinterface:supervisor]
supervisor.rpcinterface_factory=supervisor.rpcinterface:make_main_rpcinterface

# Tell supervisorctl where to connect.
[supervisorctl]
serverurl=unix:///tmp/supervisor.sock

[program:postgresql]
command=/usr/lib/postgresql/15/bin/postgres -D /data/postgres
user=postgres
Expand Down