Add docker-compose support with environment variable configuration
- Create docker-compose.yml with server and agent services - Add environment variable support to Dockerfiles via entrypoint scripts - Configure server with ADDR, PORT, USERNAME, PASSWORD vars - Configure agent with SERVER, INTERVAL, AGENT_ID vars - Add health check to server service for container orchestration - Add service dependencies to ensure server starts before agent - Create .dockerignore to optimize Docker builds - Update QUICKSTART.md with Docker Compose instructions - Support running server only, agent only, or full stack - Support multiple agents with custom identifiers
This commit is contained in:
@@ -43,6 +43,14 @@ EXPOSE 8080
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||
CMD wget --quiet --tries=1 --spider http://localhost:8080/login || exit 1
|
||||
|
||||
# Create entrypoint script to handle environment variables
|
||||
RUN echo '#!/bin/sh\n\
|
||||
ADDR=${ADDR:-0.0.0.0}\n\
|
||||
PORT=${PORT:-8080}\n\
|
||||
USERNAME=${USERNAME:-admin}\n\
|
||||
PASSWORD=${PASSWORD:-admin}\n\
|
||||
exec ./nerd-monitor-server -addr "$ADDR" -port "$PORT" -username "$USERNAME" -password "$PASSWORD"\n\
|
||||
' > /app/entrypoint.sh && chmod +x /app/entrypoint.sh
|
||||
|
||||
# Run the server
|
||||
ENTRYPOINT ["./nerd-monitor-server"]
|
||||
CMD ["-addr", "0.0.0.0", "-port", "8080"]
|
||||
ENTRYPOINT ["/app/entrypoint.sh"]
|
||||
|
||||
Reference in New Issue
Block a user