diff --git a/.devfile.Dockerfile b/.devfile.Dockerfile index fe67b0a..5866593 100644 --- a/.devfile.Dockerfile +++ b/.devfile.Dockerfile @@ -29,12 +29,13 @@ RUN curl -fsSL ${NODE_BASE_URL}/node-${NODE_VERSION}-${NODE_DISTRO}.tar.gz -o no ENV VSCODE_NODEJS_RUNTIME_DIR=/usr/local/lib/nodejs/node-${NODE_VERSION}-${NODE_DISTRO}/bin ENV PATH=${VSCODE_NODEJS_RUNTIME_DIR}:$PATH -RUN apt-get install -y npm \ +RUN apt-get install -y npm ssh sshpass \ && npm install -g http-server +WORKDIR /projects USER user -# Install OpenWRT build dependencies +# OpenWRT build ARG OPENWRT_BASE_URL='https://github.com/openwrt/openwrt' ARG OPENWRT_VERSION='21.02.3' @@ -48,7 +49,6 @@ RUN cd /tmp/pre-install \ && unzip "/tmp/pre-install/openwrt-${OPENWRT_VERSION}.zip" -d /tmp/pre-install \ && rm -rf /tmp/pre-install/openwrt-${OPENWRT_VERSION}.zip \ && cd /tmp/pre-install/openwrt-${OPENWRT_VERSION} \ - && cp /tmp/pre-install/openwrt/.config /tmp/pre-install/openwrt-${OPENWRT_VERSION}/.config \ && cp -r /tmp/pre-install/openwrt/package /tmp/pre-install/openwrt-${OPENWRT_VERSION}/package \ && cd /tmp/pre-install/openwrt-${OPENWRT_VERSION} \ && scripts/feeds update -a -f \ @@ -56,18 +56,19 @@ RUN cd /tmp/pre-install \ && cp /tmp/pre-install/openwrt/.config /tmp/pre-install/openwrt-${OPENWRT_VERSION}/.config \ && make defconfig \ && make -j$(nproc) \ - && mv bin ../openwrt \ + && chmod -R 0777 /tmp/pre-install/openwrt-${OPENWRT_VERSION}/ \ + && zip -r helloworld.zip build_dir/target-x86_64_musl/helloworld-1.0.1 || true \ + && mv helloworld.zip ../openwrt || true \ + && zip -r root-x86.zip staging_dir/target-x86_64_musl/root-x86 || true \ + && mv root-x86.zip ../openwrt || true \ + && zip -r x86_64-openwrt-linux-gdb.zip staging_dir/toolchain-x86_64_gcc-8.4.0_musl/bin/x86_64-openwrt-linux-gdb || true \ + && mv x86_64-openwrt-linux-gdb.zip ../openwrt || true \ + && zip -r bin.zip bin \ && rm -r bin \ - && mv build_dir ../openwrt \ - && rm -r build_dir \ - && mv dl ../openwrt \ - && rm -r dl \ - && mv feeds ../openwrt \ + && mv bin.zip ../openwrt \ + && zip -r feeds.zip feeds \ && rm -r feeds \ - && mv staging_dir ../openwrt \ - && rm -r staging_dir \ - && mv tmp ../openwrt \ - && rm -r tmp \ + && mv feeds.zip ../openwrt \ && cd /tmp/pre-install \ && rm -rf /tmp/pre-install/openwrt-${OPENWRT_VERSION} diff --git a/dockerfiles/qemu.Dockerfile b/dockerfiles/qemu.Dockerfile index a57c841..d6b2184 100644 --- a/dockerfiles/qemu.Dockerfile +++ b/dockerfiles/qemu.Dockerfile @@ -2,20 +2,16 @@ FROM docker.io/library/alpine:3.19.1 # Install QEMU, remove large unnecessary files RUN apk add --no-cache \ - g++ \ make \ curl \ make \ qemu-chardev-spice \ qemu-hw-display-virtio-vga \ - qemu-hw-usb-redirect \ qemu-img \ qemu-system-x86_64 \ qemu-ui-spice-core \ socat \ perl \ - openssh \ - sshpass \ && \ rm -f /usr/share/qemu/edk2-* @@ -88,7 +84,7 @@ uci set firewall.@rule[-1].name="Allow-Admin" \n\ uci set firewall.@rule[-1].enabled="true" \n\ uci set firewall.@rule[-1].src="wan" \n\ uci set firewall.@rule[-1].proto="tcp" \n\ -uci set firewall.@rule[-1].dest_port="22 80 443" \n\ +uci set firewall.@rule[-1].dest_port="22 80 443 9000" \n\ uci set firewall.@rule[-1].target="ACCEPT" \n\ uci commit firewall \n\ \n\' > /usr/local/share/vmconfig/vm.d/20-firewall.sh && \ @@ -183,13 +179,6 @@ exec /usr/bin/qemu-system-x86_64 \\\n\ -spice port=5900,password-secret=secvnc0 \\\n\ -device intel-hda \\\n\ -device hda-duplex \\\n\ - -device ich9-usb-ehci1,id=usb \\\n\ - -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,multifunction=on \\\n\ - -device ich9-usb-uhci2,masterbus=usb.0,firstport=2 \\\n\ - -chardev spicevmc,name=usbredir,id=usbredirchardev1 \\\n\ - -device usb-redir,chardev=usbredirchardev1,id=usbredirdev1 \\\n\ - -chardev spicevmc,name=usbredir,id=usbredirchardev2 \\\n\ - -device usb-redir,chardev=usbredirchardev2,id=usbredirdev2 \\\n\ $QEMU_ARGS \\\n\ \n' > /usr/local/bin/run-vm.sh && \ chmod +x /usr/local/bin/run-vm.sh @@ -220,14 +209,13 @@ ENV QEMU_STORAGE="1G" ENV QEMU_SMP="2" ENV QEMU_LAN_OPTIONS="" ENV QEMU_WAN_NETWORK="172.16.0.0/24" -ENV QEMU_WAN_OPTIONS="hostfwd=tcp::39000-:9000,hostfwd=tcp::30022-:22,hostfwd=tcp::30080-:80,hostfwd=tcp::30443-:443,hostfwd=udp::51820-:51820" +ENV QEMU_WAN_OPTIONS="hostfwd=tcp::30022-:22,hostfwd=tcp::30080-:80,hostfwd=tcp::30443-:443,hostfwd=udp::51820-:51820" ENV QEMU_PASSWORD="pass1234" ENV QEMU_CONFIG_TIMEOUT="300" ENV QEMU_CONFIG_NO_DEFAULTS="" ENV QEMU_HOSTNAME="OpenWrtVM" ENV QEMU_ARGS="" -EXPOSE 39000/tcp EXPOSE 5900/tcp EXPOSE 30022/tcp EXPOSE 30080/tcp @@ -237,6 +225,6 @@ EXPOSE 51820/udp HEALTHCHECK --interval=30s --timeout=30s --start-period=120s --retries=3 CMD [ "/usr/local/bin/healthcheck-vm.sh" ] VOLUME /var/lib/vmconfig VOLUME /var/lib/qemu -WORKDIR /tmp +WORKDIR /projects USER 1001 CMD ["tail", "-f", "/dev/null"] \ No newline at end of file