-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
76 lines (64 loc) · 2 KB
/
Dockerfile
File metadata and controls
76 lines (64 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Use official Valkey image as base
FROM valkey/valkey:9.0-trixie
# Install Python and build dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
python3 \
python3-pip \
python3-venv \
gcc \
g++ \
curl \
supervisor \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Copy application files
COPY pyproject.toml ./
COPY app/ ./app/
# Install Python dependencies and application
RUN pip3 install --no-cache-dir --break-system-packages --ignore-installed .
# Copy configuration files
COPY valkey.conf /etc/valkey/valkey.conf
COPY .env.example /app/.env
# Create supervisor and log directories
RUN mkdir -p /etc/supervisor/conf.d /var/log/valkey /var/log/supervisor && \
chown -R valkey:valkey /var/log/valkey
COPY <<'EOF' /etc/supervisor/conf.d/supervisord.conf
[supervisord]
nodaemon=true
user=root
logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid
[program:valkey]
command=/usr/local/bin/valkey-server /etc/valkey/valkey.conf
autostart=true
autorestart=true
user=valkey
stdout_logfile=/var/log/valkey/valkey.log
stderr_logfile=/var/log/valkey/valkey-error.log
priority=1
[program:pulsar-relay]
command=/usr/bin/python3 -m uvicorn pulsar_relay.main:app --host 0.0.0.0 --port 8080 --workers 4
directory=/app
autostart=true
autorestart=true
user=root
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
environment=PULSAR_STORAGE_BACKEND="valkey",PULSAR_VALKEY_HOST="localhost",PULSAR_VALKEY_PORT="6379"
priority=2
EOF
# Expose only the Pulsar Relay API port
EXPOSE 8080
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD curl -f http://localhost:8080/health || exit 1
# Set environment variables
ENV PULSAR_STORAGE_BACKEND=valkey \
PULSAR_VALKEY_HOST=localhost \
PULSAR_VALKEY_PORT=6379 \
PULSAR_LOG_LEVEL=INFO
# Use supervisor to run both services
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]