-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
171 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,69 @@ | ||
FROM quay.io/devfile/universal-developer-image:ubi8-6eb0041 | ||
|
||
# Switching to root user (setting UID to 0) because next | ||
# commands require root privileges. Universal Developer | ||
# Image default user has UID set to 10001. | ||
USER 0 | ||
|
||
RUN dnf -y update && dnf -y install \ | ||
gcc gcc-c++ make ncurses-devel patch rsync tar unzip bzip2 wget which diffutils python2 python3 perl &&\ | ||
dnf -y clean all --enablerepo='*' | ||
|
||
RUN npm install -g http-server | ||
# Switch back to default user | ||
USER 10001 | ||
|
||
ARG OPENWRT_BASE_URL='https://github.com/openwrt/openwrt' | ||
ARG OPENWRT_VERSION='23.05.0-rc1' | ||
|
||
COPY ${PWD}/package/helloworld /tmp/helloworld | ||
COPY ${PWD}/configs/.x86-generic.config /tmp/.config | ||
|
||
RUN mkdir -p /tmp/pre-install /tmp/pre-install/openwrt /tmp/pre-install/openwrt/${OPENWRT_VERSION} \ | ||
&& curl "${OPENWRT_BASE_URL}/archive/refs/tags/v${OPENWRT_VERSION}.zip" -L -o "/tmp/pre-install/openwrt-${OPENWRT_VERSION}.zip" \ | ||
&& 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} \ | ||
&& scripts/feeds update -a -f \ | ||
&& scripts/feeds install -a -f \ | ||
&& cp /tmp/.config /tmp/pre-install/openwrt-${OPENWRT_VERSION}/.config \ | ||
&& cp -r /tmp/helloworld /tmp/pre-install/openwrt-${OPENWRT_VERSION}/package/helloworld \ | ||
&& cd /tmp/pre-install/openwrt-${OPENWRT_VERSION} \ | ||
&& make defconfig \ | ||
&& make -j1 \ | ||
&& mv bin /tmp/pre-install/openwrt/${OPENWRT_VERSION}/bin \ | ||
&& mv build_dir /tmp/pre-install/openwrt/${OPENWRT_VERSION}/build_dir \ | ||
&& mv dl /tmp/pre-install/openwrt/${OPENWRT_VERSION}/dl \ | ||
&& mv feeds /tmp/pre-install/openwrt/${OPENWRT_VERSION}/feeds \ | ||
&& mv staging_dir /tmp/pre-install/openwrt/${OPENWRT_VERSION}/staging_dir \ | ||
&& mv tmp /tmp/pre-install/openwrt/${OPENWRT_VERSION}/tmp \ | ||
&& rm -rf /tmp/pre-install/openwrt-${OPENWRT_VERSION} | ||
FROM docker.io/debian:buster | ||
|
||
USER root | ||
# Install openwrt build dependencies | ||
RUN apt-get update &&\ | ||
apt-get install -y \ | ||
sudo ccache time git-core subversion build-essential g++ bash make \ | ||
libssl-dev patch libncurses5 libncurses5-dev zlib1g-dev gawk \ | ||
flex gettext wget zip unzip xz-utils python python-distutils-extra \ | ||
python3 python3-distutils-extra rsync curl libsnmp-dev liblzma-dev \ | ||
libpam0g-dev cpio rsync re2c && \ | ||
wget https://github.com/cli/cli/releases/download/v2.39.2/gh_2.39.2_linux_amd64.deb && \ | ||
apt-get install -f ./gh_2.39.2_linux_amd64.deb && \ | ||
rm -f ./gh_2.39.2_linux_amd64.deb && \ | ||
apt-get clean && \ | ||
useradd -m user && \ | ||
echo 'user ALL=NOPASSWD: ALL' > /etc/sudoers.d/user | ||
|
||
# Install Node.js for che-code editor | ||
ARG NODE_VERSION=v20.12.2 | ||
ARG NODE_DISTRO=linux-x64 | ||
ARG NODE_BASE_URL=https://nodejs.org/dist/${NODE_VERSION} | ||
|
||
RUN curl -fsSL ${NODE_BASE_URL}/node-${NODE_VERSION}-${NODE_DISTRO}.tar.gz -o node-${NODE_VERSION}-${NODE_DISTRO}.tar.gz \ | ||
&& mkdir -p /usr/local/lib/nodejs \ | ||
&& tar -xzf node-${NODE_VERSION}-${NODE_DISTRO}.tar.gz -C /usr/local/lib/nodejs \ | ||
&& rm node-${NODE_VERSION}-${NODE_DISTRO}.tar.gz | ||
|
||
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 \ | ||
&& npm install -g http-server | ||
|
||
USER user | ||
|
||
# Install OpenWRT build dependencies | ||
#ARG OPENWRT_BASE_URL='https://github.com/openwrt/openwrt' | ||
#ARG OPENWRT_VERSION='23.05.0-rc1' | ||
# | ||
#COPY ${PWD}/package/helloworld /tmp/helloworld | ||
#COPY ${PWD}/configs/.x86-generic.config /tmp/.config | ||
# | ||
#RUN mkdir -p /tmp/pre-install /tmp/pre-install/openwrt /tmp/pre-install/openwrt/${OPENWRT_VERSION} \ | ||
# && curl "${OPENWRT_BASE_URL}/archive/refs/tags/v${OPENWRT_VERSION}.zip" -L -o "/tmp/pre-install/openwrt-${OPENWRT_VERSION}.zip" \ | ||
# && 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/.config /tmp/pre-install/openwrt-${OPENWRT_VERSION}/.config \ | ||
# && cp -r /tmp/helloworld /tmp/pre-install/openwrt-${OPENWRT_VERSION}/package/helloworld \ | ||
# && cd /tmp/pre-install/openwrt-${OPENWRT_VERSION} \ | ||
# && make defconfig \ | ||
# && scripts/feeds update -a -f \ | ||
# && scripts/feeds install -a -f \ | ||
# && make -j$(nproc) || true \ | ||
# && zip -r /tmp/pre-install/bin.zip /tmp/pre-install/openwrt-${OPENWRT_VERSION}/bin || true \ | ||
# && rm -rf /tmp/pre-install/openwrt-${OPENWRT_VERSION}/bin \ | ||
# && zip -r /tmp/pre-install/build_dir.zip /tmp/pre-install/openwrt-${OPENWRT_VERSION}/build_dir || true \ | ||
# && rm -rf /tmp/pre-install/openwrt-${OPENWRT_VERSION}/build_dir \ | ||
# && zip -r /tmp/pre-install/dl.zip /tmp/pre-install/openwrt-${OPENWRT_VERSION}/dl || true \ | ||
# && rm -rf /tmp/pre-install/openwrt-${OPENWRT_VERSION}/dl \ | ||
# && zip -r /tmp/pre-install/feeds.zip /tmp/pre-install/openwrt-${OPENWRT_VERSION}/feeds || true \ | ||
# && rm -rf /tmp/pre-install/openwrt-${OPENWRT_VERSION}/feeds \ | ||
# && zip -r /tmp/pre-install/staging_dir.zip /tmp/pre-install/openwrt-${OPENWRT_VERSION}/staging_dir || true \ | ||
# && rm -rf /tmp/pre-install/openwrt-${OPENWRT_VERSION}/staging_dir \ | ||
# && zip -r /tmp/pre-install/tmp.zip /tmp/pre-install/openwrt-${OPENWRT_VERSION}/tmp || true \ | ||
# && rm -rf /tmp/pre-install/openwrt-${OPENWRT_VERSION} | ||
|
||
CMD ["tail", "-f", "/dev/null"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM scratch | ||
ADD output/openwrt-x86-generic-generic-rootfs.tar.gz / | ||
|
||
EXPOSE 80 | ||
|
||
RUN mkdir /var/lock && \ | ||
opkg update && \ | ||
opkg install uhttpd-mod-lua && \ | ||
uci set uhttpd.main.interpreter='.lua=/usr/bin/lua' && \ | ||
uci set uhttpd.main.redirect_https=1 && \ | ||
uci commit uhttpd | ||
|
||
USER root | ||
|
||
CMD ["/sbin/init"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
if [ -f /tmp/pre-install/openwrt/feeds.zip ]; then | ||
if [ -d /projects/openwrt/feeds ]; then | ||
rm -rf /projects/openwrt/feeds | ||
fi | ||
unzip /tmp/pre-install/openwrt/feeds.zip && mv /tmp/pre-install/openwrt/feeds /projects/openwrt/ | ||
fi | ||
|
||
if [ -f /tmp/pre-install/openwrt/targets.zip ]; then | ||
if [ -d /projects/openwrt/bin/targets ]; then | ||
rm -rf /projects/openwrt/bin/targets | ||
fi | ||
if [ ! -d /projects/openwrt/bin ]; then | ||
mkdir -p /projects/openwrt/bin | ||
fi | ||
unzip /tmp/pre-install/openwrt/targets.zip && mv /tmp/pre-install/openwrt/targets /projects/openwrt/bin | ||
fi | ||
|
||
if [ ! -d /projects/openwrt-helloworld/output ]; then | ||
mkdir -p /projects/openwrt-helloworld/output | ||
fi | ||
|
||
cp -r /projects/openwrt/bin/targets/*/*/openwrt-*.gz /projects/openwrt-helloworld/output/ |