services-xbee_net/Dockerfile

41 lines
1.0 KiB
Docker
Raw Normal View History

# Use an official Rust image as the base
FROM rust:latest
2024-08-16 13:37:05 -03:00
# Install necessary packages including supervisord
RUN apt-get update && apt-get install -y \
libudev-dev \
iproute2 \
iputils-ping \
net-tools \
bridge-utils \
iptables \
supervisor \
&& 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
RUN cargo build --release
2024-08-16 13:37:05 -03:00
# Copy the built binary to /usr/local/bin
RUN cp target/release/xbnet /usr/local/bin/xbnet
# Copy the entrypoint script
2024-08-16 13:37:05 -03:00
COPY ./scripts/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
# 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
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