Skip to content

Commit

Permalink
chore: Update Dockerfile and entrypoint.sh for genmon
Browse files Browse the repository at this point in the history
  • Loading branch information
dragonfire1119 committed May 16, 2024
1 parent f5fb188 commit 783ff5c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
6 changes: 2 additions & 4 deletions genmon/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Use a specific tag for a stable and predictable base image.
FROM python:3.8-slim
# Base image python:3.8-slim is chosen for its minimal size while still providing Python 3.8.

# Set non-interactive mode and define timezone to avoid unnecessary prompts during build.
ENV DEBIAN_FRONTEND=noninteractive TZ="America/Chicago"
Expand All @@ -12,7 +11,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /var/cache/apt/*

# Expose necessary ports for HTTPS, and the application.
# Expose necessary ports for HTTPS and the application.
EXPOSE 443 8000

# Set the working directory for any subsequent instructions.
Expand All @@ -28,7 +27,6 @@ RUN git clone --depth 1 http://github.com/jgyates/genmon.git && \

# Initialize the application and configure it.
RUN /git/genmon/genmonmaint.sh -i -n
# Run initial setup scripts.

# Clean up apt caches.
RUN apt-get clean && \
Expand All @@ -40,5 +38,5 @@ COPY entrypoint.sh /entrypoint.sh
# Make the entrypoint script executable.
RUN chmod +x /entrypoint.sh

# Set the custom entrypoint script as the entrypoint
# Set the custom entrypoint script as the entrypoint.
ENTRYPOINT ["/entrypoint.sh"]
16 changes: 16 additions & 0 deletions genmon/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
#!/bin/bash
set -e

# Ensure the /var/log/startup.log file exists
touch /var/log/startup.log

# Ensure the /git/genmon directory exists and has the necessary files
if [ ! -f /git/genmon/startgenmon.sh ]; then
echo "Populating /git/genmon..."
git clone --depth 1 http://github.com/jgyates/genmon.git /git/genmon
chmod 775 /git/genmon/startgenmon.sh /git/genmon/genmonmaint.sh
rm -rf /git/genmon/.git
fi

# Ensure the /etc/genmon directory exists and has the necessary configuration files
if [ ! -f /etc/genmon/genmon.conf ]; then
echo "Creating default configuration in /etc/genmon..."
mkdir -p /etc/genmon
cp /git/genmon/genmon.conf /etc/genmon/genmon.conf
fi

# Change the environment variable to use serial TCP in the genmon.conf file
sed -i "s/use_serial_tcp = .*/use_serial_tcp = $USE_SERIAL_TCP/g" /etc/genmon/genmon.conf

Expand Down

0 comments on commit 783ff5c

Please sign in to comment.