Skip to content

Commit

Permalink
fix: update Dockerfile
Browse files Browse the repository at this point in the history
Signed-off-by: Oleksii Orel <[email protected]>
  • Loading branch information
olexii4 committed May 16, 2024
1 parent c70c8df commit 61dd37a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 28 deletions.
24 changes: 11 additions & 13 deletions .devfile.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand All @@ -48,26 +49,23 @@ 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 \
&& scripts/feeds install -a -f \
&& cp /tmp/pre-install/openwrt/.config /tmp/pre-install/openwrt-${OPENWRT_VERSION}/.config \
&& make defconfig \
&& make -j$(nproc) \
&& mv bin ../openwrt \
&& zip -r helloworld.zip build_dir/target-x86_64_musl/helloworld-1.0.1 || true \
&& mv helloworld.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}

Expand Down
18 changes: 3 additions & 15 deletions dockerfiles/qemu.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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-*

Expand Down Expand Up @@ -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 && \
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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"]

0 comments on commit 61dd37a

Please sign in to comment.