2024-08-08 14:11:30 -03:00
|
|
|
FROM rust:latest
|
|
|
|
|
2024-08-22 13:17:24 -03:00
|
|
|
# Install necessary packages
|
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 \
|
2024-08-16 18:07:17 -03:00
|
|
|
traceroute \
|
2024-08-22 13:17:24 -03:00
|
|
|
nmap \
|
|
|
|
tcpdump \
|
2024-08-29 12:25:32 -03:00
|
|
|
util-linux \
|
|
|
|
bsdmainutils \
|
2024-08-22 13:17:24 -03:00
|
|
|
vim \
|
2024-09-13 16:59:24 -03:00
|
|
|
openssh-server \
|
2024-08-08 14:11:30 -03:00
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
2024-09-13 16:59:24 -03:00
|
|
|
# Create necessary directories for SSH
|
|
|
|
RUN mkdir /var/run/sshd
|
|
|
|
|
|
|
|
# Create the user 'spiri' and set passwords for both 'root' and 'spiri'
|
|
|
|
RUN useradd -m spiri && \
|
|
|
|
echo 'root:spiri-friend' | chpasswd && \
|
|
|
|
echo 'spiri:spiri-friend' | chpasswd && \
|
|
|
|
sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
|
|
|
|
|
|
|
|
# Expose SSH port
|
|
|
|
EXPOSE 22
|
|
|
|
|
2024-08-08 14:11:30 -03:00
|
|
|
# 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-09-03 10:09:03 -03:00
|
|
|
# Copy the set-env-vars.sh script to set env vars
|
|
|
|
COPY ./scripts/set-env-vars.sh /set-env-vars.sh
|
|
|
|
RUN chmod +x /set-env-vars.sh
|
|
|
|
|
2024-08-16 13:37:05 -03:00
|
|
|
# Copy the health check script
|
2024-09-04 14:26:59 -03:00
|
|
|
COPY ./scripts/health-check.sh /health-check.sh
|
|
|
|
RUN chmod +x /health-check.sh
|
2024-08-16 13:14:54 -03:00
|
|
|
|
2024-09-05 10:11:34 -03:00
|
|
|
# TEST
|
|
|
|
COPY ./scripts/debug/host-setup-docker.sh /host-setup-docker.sh
|
|
|
|
RUN chmod +x /host-setup-docker.sh
|
|
|
|
|
2024-08-16 13:37:05 -03:00
|
|
|
# Add healthcheck
|
2024-09-04 14:26:59 -03:00
|
|
|
HEALTHCHECK CMD /health-check.sh || exit 1
|