Skip to content

Commit

Permalink
chore: Update genmon service Docker image to version 0.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
dragonfire1119 committed May 9, 2024
1 parent cba2065 commit dc2d756
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 21 deletions.
48 changes: 29 additions & 19 deletions genmon/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,43 @@
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"

# Install essential packages in one layer to reduce the image size.
RUN apt update && apt upgrade -y && \
DEBIAN_FRONTEND="noninteractive" TZ="America/Chicago" apt install -y --no-install-recommends \
git sudo cron net-tools nano && \
rm -rf /var/lib/apt/lists/*
# Update and upgrade packages, install necessary tools (git, sudo, cron, net-tools, nano) for the application.
# Non-interactive mode is used to avoid hanging during build due to user prompts.
# Clean up after install reduces image layers and size.
# Combine update, install, and cleanup in a single RUN to minimize layer size.
RUN apt-get update && apt-get install -y --no-install-recommends \
git sudo cron net-tools && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /var/cache/apt/*

# Expose ports for SSH, HTTPS, and a application port to get to the genmon application.
EXPOSE 22 443 8000
# Expose necessary ports for HTTPS, and the application.
EXPOSE 443 8000

# Set the working directory for any subsequent instructions.
WORKDIR /git
# '/git' directory will hold all our application files.

# Clone the repository and prepare it for use.
RUN git clone http://github.com/jgyates/genmon.git && \
# Configure application settings via environment variables.
ENV USE_SERIAL_TCP=true

# Clone the repository with shallow clone to minimize data pulled.
RUN git clone --depth 1 http://github.com/jgyates/genmon.git && \
chmod 775 /git/genmon/startgenmon.sh /git/genmon/genmonmaint.sh && \
rm -rf /git/genmon/.git
# Clone the genmon repository, modify script permissions to make them executable, and remove the .git directory to conserve space.

# Initialize the application and configure it.
RUN /git/genmon/genmonmaint.sh -i -n && \
sed -i 's/use_serial_tcp = False/use_serial_tcp = True/g' /etc/genmon/genmon.conf
# Run initial setup scripts and modify the configuration to enable TCP for serial communications.
RUN /git/genmon/genmonmaint.sh -i -n
# Run initial setup scripts.

# Clean up apt caches.
RUN apt-get clean && \
rm -rf /var/lib/apt/lists/* /var/cache/apt/*

# Copy the entrypoint script to the container.
COPY entrypoint.sh /entrypoint.sh

# Make the entrypoint script executable.
RUN chmod +x /entrypoint.sh

# Define the default command to run within the container.
CMD ["/bin/bash", "-c", "touch /var/log/startup.log && /git/genmon/startgenmon.sh start && tail -F /var/log/startup.log"]
# Ensure the startup log exists, start the genmon application, and follow the startup log for debugging and monitoring.
# Set the custom entrypoint script as the entrypoint
ENTRYPOINT ["/entrypoint.sh"]
2 changes: 1 addition & 1 deletion genmon/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.2
0.0.3
2 changes: 1 addition & 1 deletion genmon/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
# 'big-bear-genmon' is the name of the service
big-bear-genmon:
# Specifies the Docker image to use for the big-bear-genmon service
image: bigbeartechworld/big-bear-genmon:0.0.2
image: bigbeartechworld/big-bear-genmon:0.0.3
# Environment variables to set inside the container
environment:
- TZ=America/Chicago # Set the timezone to 'America/Chicago'
Expand Down
13 changes: 13 additions & 0 deletions genmon/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

# Ensure the non-root user can write where necessary
touch /var/log/startup.log

# If you need to modify configurations owned by root, you need to adjust this beforehand or run as root
sed -i "s/use_serial_tcp = .*/use_serial_tcp = $USE_SERIAL_TCP/g" /etc/genmon/genmon.conf

# Start the application
/git/genmon/startgenmon.sh start

# Follow the log for outputs
tail -F /var/log/startup.log

0 comments on commit dc2d756

Please sign in to comment.