2024-08-08 14:11:30 -03:00
|
|
|
# Use an official Rust image as the base
|
|
|
|
FROM rust:latest
|
|
|
|
|
2024-08-16 13:37:05 -03:00
|
|
|
# Install necessary packages including supervisord
|
2024-08-08 14:11:30 -03:00
|
|
|
RUN apt-get update && apt-get install -y \
|
|
|
|
libudev-dev \
|
|
|
|
iproute2 \
|
|
|
|
iputils-ping \
|
2024-08-16 13:14:54 -03:00
|
|
|
net-tools \
|
|
|
|
bridge-utils \
|
|
|
|
iptables \
|
|
|
|
supervisor \
|
2024-08-08 14:11:30 -03:00
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
# Clone the xbnet repository
|
|
|
|
RUN git clone https://github.com/jgoerzen/xbnet.git /usr/src/xbnet
|
|
|
|
|
|
|
|
# Build xbnet
|
|
|
|
WORKDIR /usr/src/xbnet
|
2024-08-16 13:14:54 -03:00
|
|
|
RUN cargo build --release
|
2024-08-08 14:11:30 -03:00
|
|
|
|
2024-08-16 13:37:05 -03:00
|
|
|
# Copy the built binary to /usr/local/bin
|
2024-08-08 14:11:30 -03:00
|
|
|
RUN cp target/release/xbnet /usr/local/bin/xbnet
|
|
|
|
|
2024-08-16 13:14:54 -03:00
|
|
|
# Copy the entrypoint script
|
2024-08-16 13:37:05 -03:00
|
|
|
COPY ./scripts/entrypoint.sh /entrypoint.sh
|
2024-08-09 16:21:47 -03:00
|
|
|
RUN chmod +x /entrypoint.sh
|
2024-08-08 14:11:30 -03:00
|
|
|
|
2024-08-16 13:14:54 -03:00
|
|
|
# Copy the supervisor config file
|
|
|
|
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
|
|
|
|
2024-08-16 13:37:05 -03:00
|
|
|
# Copy the health check script
|
2024-08-16 13:14:54 -03:00
|
|
|
COPY ./scripts/health_check.sh /health_check.sh
|
|
|
|
RUN chmod +x /health_check.sh
|
|
|
|
|
|
|
|
# Start supervisord as the main command
|
|
|
|
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
|
2024-08-16 13:37:05 -03:00
|
|
|
|
|
|
|
# Add healthcheck
|
|
|
|
HEALTHCHECK CMD /health_check.sh || exit 1
|