Working on automating build and deploy steps
This commit is contained in:
parent
9c530434a5
commit
eea579be93
14
.env
14
.env
|
@ -1,9 +1,11 @@
|
||||||
# Configuration for xbnet0
|
# Configuration for xbnet0
|
||||||
XBEE0_PORT=/dev/ttyUSB1
|
XBEE0_PORT=/dev/ttyUSB0
|
||||||
XBEE0_NET_IP=192.168.10.1
|
XBEE0_BAUDRATE=/dev/ttyUSB0
|
||||||
PING0_TARGET=192.168.10.2
|
XBEE0_NET_SRC_IP=192.168.8.1
|
||||||
|
XBEE0_NET_DST_IP=192.168.8.2
|
||||||
|
|
||||||
# Configuration for xbnet1
|
# Configuration for xbnet1
|
||||||
XBEE1_PORT=/dev/ttyUSB2
|
XBEE1_PORT=/dev/ttyUSB1
|
||||||
XBEE1_NET_IP=192.168.10.2
|
XBEE1_BAUDRATE=/dev/ttyUSB1
|
||||||
PING1_TARGET=192.168.10.1
|
XBEE1_NET_SRC_IP=192.168.8.2
|
||||||
|
XBEE1_NET_DST_IP=192.168.8.1
|
||||||
|
|
10
Dockerfile
10
Dockerfile
|
@ -13,16 +13,14 @@ RUN git clone https://github.com/jgoerzen/xbnet.git /usr/src/xbnet
|
||||||
|
|
||||||
# Build xbnet
|
# Build xbnet
|
||||||
WORKDIR /usr/src/xbnet
|
WORKDIR /usr/src/xbnet
|
||||||
RUN cargo build --release
|
RUN cargo build && cargo build --release
|
||||||
|
|
||||||
# Copy the built binary to /usr/local/bin
|
# Copy the built binary to /usr/local/bin
|
||||||
RUN cp target/release/xbnet /usr/local/bin/xbnet
|
RUN cp target/release/xbnet /usr/local/bin/xbnet
|
||||||
|
|
||||||
# Create the entrypoint script
|
# Create and copy the entrypoint script to root location "/"
|
||||||
RUN echo '#!/bin/bash\n\
|
COPY ./entrypoint.sh /
|
||||||
set -e\n\
|
RUN chmod +x /entrypoint.sh
|
||||||
exec "$@"' > /entrypoint.sh \
|
|
||||||
&& chmod +x /entrypoint.sh
|
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
CMD ["bash"]
|
CMD ["bash"]
|
||||||
|
|
|
@ -12,7 +12,7 @@ services:
|
||||||
command: >
|
command: >
|
||||||
bash -c "
|
bash -c "
|
||||||
set -x;
|
set -x;
|
||||||
xbnet ${XBEE0_PORT} tun;
|
xbnet -d --serial-speed ${XBEE0_BAUDRATE} ${XBEE0_PORT} tun;
|
||||||
ip addr add ${XBEE0_NET_IP}/24 dev xbnet0;
|
ip addr add ${XBEE0_NET_IP}/24 dev xbnet0;
|
||||||
ip link set dev xbnet0 up;
|
ip link set dev xbnet0 up;
|
||||||
ping -c 4 ${PING0_TARGET};
|
ping -c 4 ${PING0_TARGET};
|
||||||
|
@ -30,7 +30,7 @@ services:
|
||||||
command: >
|
command: >
|
||||||
bash -c "
|
bash -c "
|
||||||
set -x;
|
set -x;
|
||||||
xbnet ${XBEE1_PORT} tun;
|
xbnet -d --serial-speed ${XBEE1_BAUDRATE} ${XBEE0_PORT} tun;
|
||||||
ip addr add ${XBEE1_NET_IP}/24 dev xbnet1;
|
ip addr add ${XBEE1_NET_IP}/24 dev xbnet1;
|
||||||
ip link set dev xbnet1 up;
|
ip link set dev xbnet1 up;
|
||||||
ping -c 4 ${PING1_TARGET};
|
ping -c 4 ${PING1_TARGET};
|
||||||
|
|
|
@ -11,9 +11,9 @@ services:
|
||||||
- "${XBEE0_PORT}:${XBEE0_PORT}"
|
- "${XBEE0_PORT}:${XBEE0_PORT}"
|
||||||
command: >
|
command: >
|
||||||
bash -c "
|
bash -c "
|
||||||
xbnet ${XBEE0_PORT} tun;
|
xbnet -d --serial-speed ${XBEE0_BAUDRATE} ${XBEE0_PORT} tun;
|
||||||
ip addr add ${XBEE0_NET_IP}/24 dev xbnet0;
|
ip addr add ${XBEE1_NET_SRC_IP}/24 dev xbnet0;
|
||||||
ip link set dev xbnet0 up;
|
ip link set dev xbnet0 up;
|
||||||
ping -c 4 ${PING0_TARGET};
|
ping -c 4 ${XBEE1_NET_DST_IP};
|
||||||
sleep infinity
|
sleep infinity
|
||||||
"
|
"
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
exec "$@"
|
|
@ -1,9 +1,8 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Source and call get_connected_wifi_name
|
|
||||||
call_get_connected_wifi_name() {
|
call_get_connected_wifi_name() {
|
||||||
# Source the get_connected_wifi_name.sh script
|
# Source the get_connected_wifi_info.sh script
|
||||||
source ./scripts/get_connected_wifi_name.sh
|
source ./scripts/get_connected_wifi_info.sh
|
||||||
|
|
||||||
# Call the function to get the Wi-Fi name and capture the returned Wi-Fi name
|
# Call the function to get the Wi-Fi name and capture the returned Wi-Fi name
|
||||||
wifi_name=$(get_connected_wifi_name)
|
wifi_name=$(get_connected_wifi_name)
|
||||||
|
@ -16,10 +15,9 @@ call_get_connected_wifi_name() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Source and call get_connected_wifi_device
|
|
||||||
call_get_connected_wifi_device() {
|
call_get_connected_wifi_device() {
|
||||||
# Source the get_connected_wifi_name.sh script
|
# Source the get_connected_wifi_info.sh script
|
||||||
source ./scripts/get_connected_wifi_name.sh
|
source ./scripts/get_connected_wifi_info.sh
|
||||||
|
|
||||||
# Call the function to get the Wi-Fi device and capture the returned Wi-Fi device
|
# Call the function to get the Wi-Fi device and capture the returned Wi-Fi device
|
||||||
wifi_device=$(get_connected_wifi_device)
|
wifi_device=$(get_connected_wifi_device)
|
||||||
|
|
Loading…
Reference in New Issue