Compare commits
17 Commits
master
...
docker-rev
| Author | SHA1 | Date | |
|---|---|---|---|
| 67075a0094 | |||
| be1a59d959 | |||
| 84a69ac66a | |||
| e240561fb9 | |||
| 1643156ee4 | |||
| e3c9d87e61 | |||
| 31d9a027bb | |||
| 00992e16c0 | |||
| c7a970dadf | |||
| 02a74081c1 | |||
| 65865ea2f6 | |||
| 53a5525de4 | |||
| 55143adcf6 | |||
| 0a9767d001 | |||
| bacd7171bf | |||
| e63cf2a777 | |||
| 472f9f3a68 |
74
Dockerfile.fedora
Normal file
74
Dockerfile.fedora
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
# syntax=docker/dockerfile:experimental
|
||||||
|
|
||||||
|
FROM fedora:39
|
||||||
|
|
||||||
|
RUN dnf update -y && dnf install -y \
|
||||||
|
curl \
|
||||||
|
git \
|
||||||
|
git-lfs \
|
||||||
|
htop \
|
||||||
|
vim \
|
||||||
|
nano \
|
||||||
|
tar \
|
||||||
|
bzip2 \
|
||||||
|
unzip \
|
||||||
|
python3-pip \
|
||||||
|
&& rm -rf /var/cache/dnf \
|
||||||
|
&& git lfs install \
|
||||||
|
&& curl -fsSL https://code-server.dev/install.sh | sh
|
||||||
|
|
||||||
|
RUN useradd -u 1000 coder
|
||||||
|
|
||||||
|
COPY code-server.tar.gz /tmp
|
||||||
|
COPY settings.json /tmp
|
||||||
|
COPY config.yaml /tmp
|
||||||
|
COPY project-creator.py /tmp
|
||||||
|
COPY entrypoint.sh /usr/bin
|
||||||
|
|
||||||
|
ARG WPILIB_DL_URL
|
||||||
|
ARG WPILIB_FILE_NAME=wpilib.tar.gz
|
||||||
|
|
||||||
|
RUN chmod 755 /usr/bin/entrypoint.sh \
|
||||||
|
&& curl -fsSL ${WPILIB_DL_URL} -o /tmp/${WPILIB_FILE_NAME} \
|
||||||
|
&& tar -xzf "/tmp/${WPILIB_FILE_NAME}" -C /tmp \
|
||||||
|
&& WPILIB_ARTIFACTS="$(find /tmp -type f -name 'WPILib_Linux-*-artifacts.tar.gz' -print)" \
|
||||||
|
&& ARTIFACTSYEAR="$(echo $WPILIB_ARTIFACTS | cut -d '-' -f 2 | cut -d '.' -f 1)" \
|
||||||
|
&& mkdir -p /home/coder/wpilib/$ARTIFACTSYEAR \
|
||||||
|
&& tar -xzf "$WPILIB_ARTIFACTS" -C /home/coder/wpilib/$ARTIFACTSYEAR \
|
||||||
|
&& chown -R coder:coder /home/coder/wpilib \
|
||||||
|
&& rm -f /tmp/${WPILIB_FILE_NAME} \
|
||||||
|
&& rm -rf "$(find /tmp -type d -name 'WPILib_Linux-*' -print)" \
|
||||||
|
&& GRADLEZIP="$(ls /home/coder/wpilib/$ARTIFACTSYEAR/installUtils | grep 'gradle-.*-bin.zip')" \
|
||||||
|
&& GRADLEFOLDER="/home/coder/gradle-$(echo \"$GRADLEZIP\" | cut -d '-' -f 2)" \
|
||||||
|
&& unzip /home/coder/wpilib/$ARTIFACTSYEAR/installUtils/$GRADLEZIP -d /home/coder/ \
|
||||||
|
&& chown -R coder:coder $GRADLEFOLDER \
|
||||||
|
&& mkdir /home/coder/.bashrc.d \
|
||||||
|
&& touch /home/coder/.bashrc.d/wpilib.sh \
|
||||||
|
&& chown -R coder:coder /home/coder/.bashrc.d \
|
||||||
|
&& echo "export JAVA_HOME=/home/coder/wpilib/$ARTIFACTSYEAR/jdk" >> "/home/coder/.bashrc.d/wpilib.sh" \
|
||||||
|
&& echo "export PATH=$PATH:/home/coder/wpilib/$ARTIFACTSYEAR/jdk/bin" >> "/home/coder/.bashrc.d/wpilib.sh" \
|
||||||
|
&& echo "export PATH=$PATH:$GRADLEFOLDER/bin" >> "/home/coder/.bashrc.d/wpilib.sh" \
|
||||||
|
&& source /home/coder/.bashrc.d/wpilib.sh \
|
||||||
|
&& su -c "/home/coder/wpilib/$ARTIFACTSYEAR/jdk/bin/java -jar /home/coder/wpilib/$ARTIFACTSYEAR/maven/MavenMetaDataFixer.jar" "coder" \
|
||||||
|
&& rm -rf /home/coder/wpilib/$ARTIFACTSYEAR/advantagescope \
|
||||||
|
&& rm -f /home/coder/wpilib/$ARTIFACTSYEAR/installUtils/$GRADLEZIP \
|
||||||
|
&& rm -rf /home/coder/wpilib/$ARTIFACTSYEAR/tools \
|
||||||
|
&& rm -rf /home/coder/wpilib/$ARTIFACTSYEAR/documentation \
|
||||||
|
&& rm -rf /root/.cache \
|
||||||
|
&& su -c "mkdir -p /home/coder/.local/share" "coder" \
|
||||||
|
&& su -c "mkdir -p /home/coder/.config/code-server" "coder" \
|
||||||
|
&& su -c "tar -xzf /tmp/code-server.tar.gz -C /home/coder/.local/share" "coder" \
|
||||||
|
&& su -c "cp -f /tmp/settings.json /home/coder/.local/share/code-server/User" "coder" \
|
||||||
|
&& su -c "sed -i 's/###YEAR###/$ARTIFACTSYEAR/g;' /home/coder/.local/share/code-server/User/settings.json" "coder" \
|
||||||
|
&& su -c "cp -f /tmp/config.yaml /home/coder/.config/code-server" "coder" \
|
||||||
|
&& su -c "cp -f /tmp/project-creator.py /home/coder" "coder" \
|
||||||
|
&& for EXTENSION in /home/coder/wpilib/$ARTIFACTSYEAR/vsCodeExtensions/*.vsix; do su -c "code-server --install-extension $EXTENSION" "coder"; done
|
||||||
|
|
||||||
|
EXPOSE 8080
|
||||||
|
|
||||||
|
USER coder
|
||||||
|
ENV USER=coder
|
||||||
|
WORKDIR /home/coder
|
||||||
|
ENTRYPOINT ["/usr/bin/entrypoint.sh", "coder"]
|
||||||
|
|
||||||
|
|
||||||
80
Dockerfile.pwsh.fedora
Normal file
80
Dockerfile.pwsh.fedora
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
# syntax=docker/dockerfile:experimental
|
||||||
|
|
||||||
|
FROM fedora:39
|
||||||
|
|
||||||
|
RUN dnf update -y && dnf install -y \
|
||||||
|
curl \
|
||||||
|
git \
|
||||||
|
git-lfs \
|
||||||
|
htop \
|
||||||
|
vim \
|
||||||
|
nano \
|
||||||
|
tar \
|
||||||
|
bzip2 \
|
||||||
|
unzip \
|
||||||
|
python3-pip \
|
||||||
|
&& rm -rf /var/cache/dnf \
|
||||||
|
&& git lfs install \
|
||||||
|
&& curl -fsSL https://code-server.dev/install.sh | sh
|
||||||
|
|
||||||
|
RUN curl -sSL https://packages.microsoft.com/config/rhel/9/packages-microsoft-prod.rpm -o /tmp/ms-prod.rpm \
|
||||||
|
&& rpm -i /tmp/ms-prod.rpm \
|
||||||
|
&& rm -f /tmp/ms-prod.rpm \
|
||||||
|
&& dnf install powershell -y \
|
||||||
|
&& rm -rf /var/cache/dnf
|
||||||
|
|
||||||
|
RUN useradd -u 1000 coder
|
||||||
|
|
||||||
|
COPY code-server.tar.gz /tmp
|
||||||
|
COPY settings.json /tmp
|
||||||
|
COPY config.yaml /tmp
|
||||||
|
COPY project-creator.py /tmp
|
||||||
|
COPY entrypoint.sh /usr/bin
|
||||||
|
|
||||||
|
ARG WPILIB_DL_URL
|
||||||
|
ARG WPILIB_FILE_NAME=wpilib.tar.gz
|
||||||
|
|
||||||
|
RUN chmod 755 /usr/bin/entrypoint.sh \
|
||||||
|
&& curl -fsSL ${WPILIB_DL_URL} -o /tmp/${WPILIB_FILE_NAME} \
|
||||||
|
&& tar -xzf "/tmp/${WPILIB_FILE_NAME}" -C /tmp \
|
||||||
|
&& WPILIB_ARTIFACTS="$(find /tmp -type f -name 'WPILib_Linux-*-artifacts.tar.gz' -print)" \
|
||||||
|
&& ARTIFACTSYEAR="$(echo $WPILIB_ARTIFACTS | cut -d '-' -f 2 | cut -d '.' -f 1)" \
|
||||||
|
&& mkdir -p /home/coder/wpilib/$ARTIFACTSYEAR \
|
||||||
|
&& tar -xzf "$WPILIB_ARTIFACTS" -C /home/coder/wpilib/$ARTIFACTSYEAR \
|
||||||
|
&& chown -R coder:coder /home/coder/wpilib \
|
||||||
|
&& rm -f /tmp/${WPILIB_FILE_NAME} \
|
||||||
|
&& rm -rf "$(find /tmp -type d -name 'WPILib_Linux-*' -print)" \
|
||||||
|
&& GRADLEZIP="$(ls /home/coder/wpilib/$ARTIFACTSYEAR/installUtils | grep 'gradle-.*-bin.zip')" \
|
||||||
|
&& GRADLEFOLDER="/home/coder/gradle-$(echo \"$GRADLEZIP\" | cut -d '-' -f 2)" \
|
||||||
|
&& unzip /home/coder/wpilib/$ARTIFACTSYEAR/installUtils/$GRADLEZIP -d /home/coder/ \
|
||||||
|
&& chown -R coder:coder $GRADLEFOLDER \
|
||||||
|
&& mkdir -p /home/coder/.config/powershell \
|
||||||
|
&& chown -R coder:coder /home/coder/.config \
|
||||||
|
&& echo "\$JAVA_HOME=\"/home/coder/wpilib/$ARTIFACTSYEAR/jdk\"" >> "/home/coder/.config/powershell/Microsoft.PowerShell_profile.ps1" \
|
||||||
|
&& echo "\$env:PATH+=\":/home/coder/wpilib/$ARTIFACTSYEAR/jdk/bin\"" >> "/home/coder/.config/powershell/Microsoft.PowerShell_profile.ps1" \
|
||||||
|
&& echo "\$env:PATH+=\":$GRADLEFOLDER/bin\"" >> "/home/coder/.config/powershell/Microsoft.PowerShell_profile.ps1" \
|
||||||
|
&& su -c "/home/coder/wpilib/$ARTIFACTSYEAR/jdk/bin/java -jar /home/coder/wpilib/$ARTIFACTSYEAR/maven/MavenMetaDataFixer.jar" "coder" \
|
||||||
|
&& rm -rf /home/coder/wpilib/$ARTIFACTSYEAR/advantagescope \
|
||||||
|
&& rm -f /home/coder/wpilib/$ARTIFACTSYEAR/installUtils/$GRADLEZIP \
|
||||||
|
&& rm -rf /home/coder/wpilib/$ARTIFACTSYEAR/tools \
|
||||||
|
&& rm -rf /home/coder/wpilib/$ARTIFACTSYEAR/documentation \
|
||||||
|
&& rm -rf /root/.cache \
|
||||||
|
&& su -c "mkdir -p /home/coder/.local/share" "coder" \
|
||||||
|
&& su -c "mkdir -p /home/coder/.config/code-server" "coder" \
|
||||||
|
&& su -c "tar -xzf /tmp/code-server.tar.gz -C /home/coder/.local/share" "coder" \
|
||||||
|
&& su -c "cp -f /tmp/settings.json /home/coder/.local/share/code-server/User" "coder" \
|
||||||
|
&& su -c "sed -i 's/###YEAR###/$ARTIFACTSYEAR/g;' /home/coder/.local/share/code-server/User/settings.json" "coder" \
|
||||||
|
&& su -c "cp -f /tmp/config.yaml /home/coder/.config/code-server" "coder" \
|
||||||
|
&& su -c "cp -f /tmp/project-creator.py /home/coder" "coder" \
|
||||||
|
&& for EXTENSION in /home/coder/wpilib/$ARTIFACTSYEAR/vsCodeExtensions/*.vsix; do su -c "code-server --install-extension $EXTENSION" "coder"; done
|
||||||
|
|
||||||
|
RUN usermod -s /usr/bin/pwsh coder
|
||||||
|
|
||||||
|
EXPOSE 8080
|
||||||
|
|
||||||
|
USER coder
|
||||||
|
ENV USER=coder
|
||||||
|
WORKDIR /home/coder
|
||||||
|
ENTRYPOINT ["/usr/bin/entrypoint.sh", "coder"]
|
||||||
|
|
||||||
|
|
||||||
81
Dockerfile.pwsh.ubuntu
Normal file
81
Dockerfile.pwsh.ubuntu
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
# syntax=docker/dockerfile:experimental
|
||||||
|
|
||||||
|
FROM ubuntu:24.04
|
||||||
|
|
||||||
|
RUN apt update -y && apt upgrade -y \
|
||||||
|
curl \
|
||||||
|
git \
|
||||||
|
git-lfs \
|
||||||
|
htop \
|
||||||
|
vim \
|
||||||
|
nano \
|
||||||
|
tar \
|
||||||
|
bzip2 \
|
||||||
|
unzip \
|
||||||
|
python3-pip \
|
||||||
|
apt-transport-https \
|
||||||
|
software-properties-common \
|
||||||
|
&& apt clean \
|
||||||
|
&& git lfs install \
|
||||||
|
&& curl -fsSL https://code-server.dev/install.sh | sh
|
||||||
|
|
||||||
|
RUN curl -sSL https://packages.microsoft.com/config/ubuntu/24.04/packages-microsoft-prod.deb -o /tmp/ms-prod.deb \
|
||||||
|
&& dpkg -i /tmp/ms-prod.deb \
|
||||||
|
&& rm -f /tmp/ms-prod.deb \
|
||||||
|
&& apt update \
|
||||||
|
&& apt install -y powershell \
|
||||||
|
&& apt clean
|
||||||
|
|
||||||
|
COPY code-server.tar.gz /tmp
|
||||||
|
COPY settings.json /tmp
|
||||||
|
COPY config.yaml /tmp
|
||||||
|
COPY project-creator.py /tmp
|
||||||
|
COPY entrypoint.sh /usr/bin
|
||||||
|
|
||||||
|
ARG WPILIB_DL_URL
|
||||||
|
ARG WPILIB_FILE_NAME=wpilib.tar.gz
|
||||||
|
|
||||||
|
RUN chmod 755 /usr/bin/entrypoint.sh \
|
||||||
|
&& curl -fsSL ${WPILIB_DL_URL} -o /tmp/${WPILIB_FILE_NAME} \
|
||||||
|
&& tar -xzf "/tmp/${WPILIB_FILE_NAME}" -C /tmp \
|
||||||
|
&& WPILIB_ARTIFACTS="$(find /tmp -type f -name 'WPILib_Linux-*-artifacts.tar.gz' -print)" \
|
||||||
|
&& ARTIFACTSYEAR="$(echo $WPILIB_ARTIFACTS | cut -d '-' -f 2 | cut -d '.' -f 1)" \
|
||||||
|
&& mkdir -p /home/ubuntu/wpilib/$ARTIFACTSYEAR \
|
||||||
|
&& tar -xzf "$WPILIB_ARTIFACTS" -C /home/ubuntu/wpilib/$ARTIFACTSYEAR \
|
||||||
|
&& chown -R ubuntu:ubuntu /home/ubuntu/wpilib \
|
||||||
|
&& rm -f /tmp/${WPILIB_FILE_NAME} \
|
||||||
|
&& rm -rf "$(find /tmp -type d -name 'WPILib_Linux-*' -print)" \
|
||||||
|
&& GRADLEZIP="$(ls /home/ubuntu/wpilib/$ARTIFACTSYEAR/installUtils | grep 'gradle-.*-bin.zip')" \
|
||||||
|
&& GRADLEFOLDER="/home/ubuntu/gradle-$(echo \"$GRADLEZIP\" | cut -d '-' -f 2)" \
|
||||||
|
&& unzip /home/ubuntu/wpilib/$ARTIFACTSYEAR/installUtils/$GRADLEZIP -d /home/ubuntu/ \
|
||||||
|
&& chown -R ubuntu:ubuntu $GRADLEFOLDER \
|
||||||
|
&& mkdir -p /home/ubuntu/.config/powershell \
|
||||||
|
&& chown -R ubuntu:ubuntu /home/ubuntu/.config \
|
||||||
|
&& echo "\$JAVA_HOME=\"/home/ubuntu/wpilib/$ARTIFACTSYEAR/jdk\"" >> "/home/ubuntu/.config/powershell/Microsoft.PowerShell_profile.ps1" \
|
||||||
|
&& echo "\$env:PATH+=\":/home/ubuntu/wpilib/$ARTIFACTSYEAR/jdk/bin\"" >> "/home/ubuntu/.config/powershell/Microsoft.PowerShell_profile.ps1" \
|
||||||
|
&& echo "\$env:PATH+=\":$GRADLEFOLDER/bin\"" >> "/home/ubuntu/.config/powershell/Microsoft.PowerShell_profile.ps1" \
|
||||||
|
&& su -c "/home/ubuntu/wpilib/$ARTIFACTSYEAR/jdk/bin/java -jar /home/ubuntu/wpilib/$ARTIFACTSYEAR/maven/MavenMetaDataFixer.jar" "ubuntu" \
|
||||||
|
&& rm -rf /home/ubuntu/wpilib/$ARTIFACTSYEAR/advantagescope \
|
||||||
|
&& rm -f /home/ubuntu/wpilib/$ARTIFACTSYEAR/installUtils/$GRADLEZIP \
|
||||||
|
&& rm -rf /home/ubuntu/wpilib/$ARTIFACTSYEAR/tools \
|
||||||
|
&& rm -rf /home/ubuntu/wpilib/$ARTIFACTSYEAR/documentation \
|
||||||
|
&& rm -rf /root/.cache \
|
||||||
|
&& su -c "mkdir -p /home/ubuntu/.local/share" "ubuntu" \
|
||||||
|
&& su -c "mkdir -p /home/ubuntu/.config/code-server" "ubuntu" \
|
||||||
|
&& su -c "tar -xzf /tmp/code-server.tar.gz -C /home/ubuntu/.local/share" "ubuntu" \
|
||||||
|
&& su -c "cp -f /tmp/settings.json /home/ubuntu/.local/share/code-server/User" "ubuntu" \
|
||||||
|
&& su -c "sed -i 's/###YEAR###/$ARTIFACTSYEAR/g;s/coder/ubuntu/g;' /home/ubuntu/.local/share/code-server/User/settings.json" "ubuntu" \
|
||||||
|
&& su -c "cp -f /tmp/config.yaml /home/ubuntu/.config/code-server" "ubuntu" \
|
||||||
|
&& su -c "cp -f /tmp/project-creator.py /home/ubuntu" "ubuntu" \
|
||||||
|
&& for EXTENSION in /home/ubuntu/wpilib/$ARTIFACTSYEAR/vsCodeExtensions/*.vsix; do su -c "code-server --install-extension $EXTENSION" "ubuntu"; done
|
||||||
|
|
||||||
|
RUN usermod -s /usr/bin/pwsh ubuntu
|
||||||
|
|
||||||
|
EXPOSE 8080
|
||||||
|
|
||||||
|
USER ubuntu
|
||||||
|
ENV USER=ubuntu
|
||||||
|
WORKDIR /home/ubuntu
|
||||||
|
ENTRYPOINT ["/usr/bin/entrypoint.sh", "ubuntu"]
|
||||||
|
|
||||||
|
|
||||||
72
Dockerfile.ubuntu
Normal file
72
Dockerfile.ubuntu
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
# syntax=docker/dockerfile:experimental
|
||||||
|
|
||||||
|
FROM ubuntu:24.04
|
||||||
|
|
||||||
|
RUN apt update -y && apt upgrade -y \
|
||||||
|
curl \
|
||||||
|
git \
|
||||||
|
git-lfs \
|
||||||
|
htop \
|
||||||
|
vim \
|
||||||
|
nano \
|
||||||
|
tar \
|
||||||
|
bzip2 \
|
||||||
|
unzip \
|
||||||
|
python3-pip \
|
||||||
|
&& apt clean \
|
||||||
|
&& git lfs install \
|
||||||
|
&& curl -fsSL https://code-server.dev/install.sh | sh
|
||||||
|
|
||||||
|
COPY code-server.tar.gz /tmp
|
||||||
|
COPY settings.json /tmp
|
||||||
|
COPY config.yaml /tmp
|
||||||
|
COPY project-creator.py /tmp
|
||||||
|
COPY entrypoint.sh /usr/bin
|
||||||
|
|
||||||
|
ARG WPILIB_DL_URL
|
||||||
|
ARG WPILIB_FILE_NAME=wpilib.tar.gz
|
||||||
|
|
||||||
|
RUN chmod 755 /usr/bin/entrypoint.sh \
|
||||||
|
&& curl -fsSL ${WPILIB_DL_URL} -o /tmp/${WPILIB_FILE_NAME} \
|
||||||
|
&& tar -xzf "/tmp/${WPILIB_FILE_NAME}" -C /tmp \
|
||||||
|
&& WPILIB_ARTIFACTS="$(find /tmp -type f -name 'WPILib_Linux-*-artifacts.tar.gz' -print)" \
|
||||||
|
&& ARTIFACTSYEAR="$(echo $WPILIB_ARTIFACTS | cut -d '-' -f 2 | cut -d '.' -f 1)" \
|
||||||
|
&& mkdir -p /home/ubuntu/wpilib/$ARTIFACTSYEAR \
|
||||||
|
&& tar -xzf "$WPILIB_ARTIFACTS" -C /home/ubuntu/wpilib/$ARTIFACTSYEAR \
|
||||||
|
&& chown -R ubuntu:ubuntu /home/ubuntu/wpilib \
|
||||||
|
&& rm -f /tmp/${WPILIB_FILE_NAME} \
|
||||||
|
&& rm -rf "$(find /tmp -type d -name 'WPILib_Linux-*' -print)" \
|
||||||
|
&& GRADLEZIP="$(ls /home/ubuntu/wpilib/$ARTIFACTSYEAR/installUtils | grep 'gradle-.*-bin.zip')" \
|
||||||
|
&& GRADLEFOLDER="/home/ubuntu/gradle-$(echo \"$GRADLEZIP\" | cut -d '-' -f 2)" \
|
||||||
|
&& unzip /home/ubuntu/wpilib/$ARTIFACTSYEAR/installUtils/$GRADLEZIP -d /home/ubuntu/ \
|
||||||
|
&& chown -R ubuntu:ubuntu $GRADLEFOLDER \
|
||||||
|
&& mkdir /home/ubuntu/.bashrc.d \
|
||||||
|
&& touch /home/ubuntu/.bashrc.d/wpilib.sh \
|
||||||
|
&& chown -R ubuntu:ubuntu /home/ubuntu/.bashrc.d \
|
||||||
|
&& echo "export JAVA_HOME=/home/ubuntu/wpilib/$ARTIFACTSYEAR/jdk" >> "/home/ubuntu/.bashrc.d/wpilib.sh" \
|
||||||
|
&& echo "export PATH=$PATH:/home/ubuntu/wpilib/$ARTIFACTSYEAR/jdk/bin" >> "/home/ubuntu/.bashrc.d/wpilib.sh" \
|
||||||
|
&& echo "export PATH=$PATH:$GRADLEFOLDER/bin" >> "/home/ubuntu/.bashrc.d/wpilib.sh" \
|
||||||
|
&& . /home/ubuntu/.bashrc.d/wpilib.sh \
|
||||||
|
&& su -c "/home/ubuntu/wpilib/$ARTIFACTSYEAR/jdk/bin/java -jar /home/ubuntu/wpilib/$ARTIFACTSYEAR/maven/MavenMetaDataFixer.jar" "ubuntu" \
|
||||||
|
&& rm -rf /home/ubuntu/wpilib/$ARTIFACTSYEAR/advantagescope \
|
||||||
|
&& rm -f /home/ubuntu/wpilib/$ARTIFACTSYEAR/installUtils/$GRADLEZIP \
|
||||||
|
&& rm -rf /home/ubuntu/wpilib/$ARTIFACTSYEAR/tools \
|
||||||
|
&& rm -rf /home/ubuntu/wpilib/$ARTIFACTSYEAR/documentation \
|
||||||
|
&& rm -rf /root/.cache \
|
||||||
|
&& su -c "mkdir -p /home/ubuntu/.local/share" "ubuntu" \
|
||||||
|
&& su -c "mkdir -p /home/ubuntu/.config/code-server" "ubuntu" \
|
||||||
|
&& su -c "tar -xzf /tmp/code-server.tar.gz -C /home/ubuntu/.local/share" "ubuntu" \
|
||||||
|
&& su -c "cp -f /tmp/settings.json /home/ubuntu/.local/share/code-server/User" "ubuntu" \
|
||||||
|
&& su -c "sed -i 's/###YEAR###/$ARTIFACTSYEAR/g;s/coder/ubuntu/g;' /home/ubuntu/.local/share/code-server/User/settings.json" "ubuntu" \
|
||||||
|
&& su -c "cp -f /tmp/config.yaml /home/ubuntu/.config/code-server" "ubuntu" \
|
||||||
|
&& su -c "cp -f /tmp/project-creator.py /home/ubuntu" "ubuntu" \
|
||||||
|
&& for EXTENSION in /home/ubuntu/wpilib/$ARTIFACTSYEAR/vsCodeExtensions/*.vsix; do su -c "code-server --install-extension $EXTENSION" "ubuntu"; done
|
||||||
|
|
||||||
|
EXPOSE 8080
|
||||||
|
|
||||||
|
USER ubuntu
|
||||||
|
ENV USER=ubuntu
|
||||||
|
WORKDIR /home/ubuntu
|
||||||
|
ENTRYPOINT ["/usr/bin/entrypoint.sh", "ubuntu"]
|
||||||
|
|
||||||
|
|
||||||
23
README.md
Normal file
23
README.md
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# Code Server for WPILIB
|
||||||
|
|
||||||
|
This project provides Dockerfiles that can be used to create container images that serve a web based version of the VSCode programming environment for WPILIB programming.
|
||||||
|
|
||||||
|
This is NOT a replacement for a decent programming computer for your build space (see the Caveats section), but more a way to provide the ability to program to students who may not have access to a computer where they are allowed to install software (school computers, family computers, etc.)
|
||||||
|
|
||||||
|
### Getting Started
|
||||||
|
|
||||||
|
You have to built the container images yourself before you can start. (See the Why Don't You Provide the Container Images? section for why).
|
||||||
|
|
||||||
|
You need to select which overarching distro you want the container to be based on. For most users this isn't super important, but the option is there for those who care. There are currently two stable options:
|
||||||
|
|
||||||
|
- Dockerfile.ubuntu (which is likely what most people will want, as it'll be very similar to existing experiences with distros like Raspberry Pi OS)
|
||||||
|
- Dockerfile.fedora (for those in the community who prefer/are familar with RHEL/OracleLinux or similar)
|
||||||
|
|
||||||
|
1. Install [Docker](https://docs.docker.com/engine/install/)
|
||||||
|
2. Open your terminal of choice
|
||||||
|
3. Clone this project using git, and "cd" to the cloned folder
|
||||||
|
4. Run the following command
|
||||||
|
```docker build --build-arg WPILIB_DL_URL=<DL_URL> -f <DockerFile> -t code-server-wpilib:latest .```
|
||||||
|
The <DL_URL> should be the Linux image appropriate to your platform from the [releases page](https://github.com/wpilibsuite/allwpilib/releases). The <DockerFile> will either be Dockerfile.ubuntu or Dockerfile.fedora
|
||||||
|
5. Start an instance of the container ```docker run -d -p 8080:8080 --name <instance_name> code-server-wpilib:latest```
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
bind-addr: IPADDRESS:PORT
|
bind-addr: 0.0.0.0:8080
|
||||||
auth: password
|
auth: password
|
||||||
password: PASSWORD
|
password: PASSWORD
|
||||||
cert: false
|
cert: false
|
||||||
|
|||||||
34
entrypoint.sh
Normal file
34
entrypoint.sh
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
CURRENT_GID=$(id -g $1)
|
||||||
|
echo "Current GID: $CURRENT_GID"
|
||||||
|
|
||||||
|
if [ -n "$USER_GID" ] && [ "$USER_GID" != "$CURRENT_GID" ]; then
|
||||||
|
echo "Changing GID to $USER_GID"
|
||||||
|
groupmod -g $USER_GID $1
|
||||||
|
find / -group $CURRENT_GID -exec chgrp -h $1 {} \;
|
||||||
|
fi
|
||||||
|
|
||||||
|
CURRENT_UID=$(id -u $1)
|
||||||
|
echo "Current UID: $CURRENT_UID"
|
||||||
|
|
||||||
|
if [ -n "$USER_UID" ] && [ "$USER_UID" != "$CURRENT_UID" ]; then
|
||||||
|
echo "Changing UID to $USER_UID"
|
||||||
|
usermod -u $USER_UID $1
|
||||||
|
find / -user $CURRENT_UID -exec chown -h $1 {} \;
|
||||||
|
fi
|
||||||
|
|
||||||
|
CURRENT_PASSWD=$(grep -E "^password: .*$" /home/$1/.config/code-server/config.yaml | cut -d ":" -f 2 | awk '{$1=$1;print}')
|
||||||
|
|
||||||
|
if [ -n "$USER_PASSWD" ] && [ "$CURRENT_PASSWD" != "$USER_PASSWD" ] || [ "$CURRENT_PASSWD" == "PASSWORD" ]; then
|
||||||
|
echo "Changing password"
|
||||||
|
if [ -z "$USER_PASSWD" ]; then
|
||||||
|
echo "Setting a new password at random"
|
||||||
|
USER_PASSWD=$(tr -dc A-Za-z0-9 < /dev/urandom | head -c 20; echo)
|
||||||
|
fi
|
||||||
|
|
||||||
|
sed -i "s/^password: .*$/password: $USER_PASSWD/g" /home/$1/.config/code-server/config.yaml
|
||||||
|
echo "Result of sed call: $?"
|
||||||
|
fi
|
||||||
|
|
||||||
|
/usr/bin/code-server --bind-addr 0.0.0.0:8080 .
|
||||||
@@ -22,13 +22,6 @@ def show_options(option_list, columns):
|
|||||||
|
|
||||||
print("")
|
print("")
|
||||||
|
|
||||||
#def show_options(option_list, columns):
|
|
||||||
# for x in range(0, len(option_list), columns):
|
|
||||||
# for y in range(x, min(len(option_list), x + columns), 1):
|
|
||||||
# print("[{opnum}] {option}".format(opnum=y, option=option_list[y]), end=' ')
|
|
||||||
#
|
|
||||||
# print("")
|
|
||||||
|
|
||||||
def get_selection(option_list, columns, prompt):
|
def get_selection(option_list, columns, prompt):
|
||||||
selection = ""
|
selection = ""
|
||||||
|
|
||||||
@@ -158,7 +151,17 @@ shutil.copytree(vendordeps, os.path.join(new_project_path, "vendordeps"), dirs_e
|
|||||||
|
|
||||||
### END Generate project directories and fill them with the appropriate files
|
### END Generate project directories and fill them with the appropriate files
|
||||||
|
|
||||||
### BEGIN Do find and replace work for java projects and all projects team number config
|
### BEGIN Do find and replace work for java and cpp projects and all projects team number config
|
||||||
|
|
||||||
|
### TODO Opening and closing build.gradle is unnecessarily repetitive,
|
||||||
|
### Might be better to lose the with calls and manually open/close the files?
|
||||||
|
with open(os.path.join(new_project_path, "build.gradle"), "r") as gradle_build_file:
|
||||||
|
gradle_build_content = gradle_build_file.read()
|
||||||
|
|
||||||
|
gradle_build_content = gradle_build_content.replace("###GRADLERIOREPLACE###", wpilib_version)
|
||||||
|
|
||||||
|
with open(os.path.join(new_project_path, "build.gradle"), "w") as gradle_build_file:
|
||||||
|
gradle_build_file.write(gradle_build_content)
|
||||||
|
|
||||||
if project_language == "java":
|
if project_language == "java":
|
||||||
|
|
||||||
@@ -167,7 +170,6 @@ if project_language == "java":
|
|||||||
with open(os.path.join(new_project_path, "build.gradle"), "r") as gradle_build_file:
|
with open(os.path.join(new_project_path, "build.gradle"), "r") as gradle_build_file:
|
||||||
gradle_build_content = gradle_build_file.read()
|
gradle_build_content = gradle_build_file.read()
|
||||||
|
|
||||||
gradle_build_content = gradle_build_content.replace("###GRADLERIOREPLACE###", wpilib_version)
|
|
||||||
gradle_build_content = gradle_build_content.replace("###ROBOTCLASSREPLACE###", "frc.robot.Main")
|
gradle_build_content = gradle_build_content.replace("###ROBOTCLASSREPLACE###", "frc.robot.Main")
|
||||||
|
|
||||||
with open(os.path.join(new_project_path, "build.gradle"), "w") as gradle_build_file:
|
with open(os.path.join(new_project_path, "build.gradle"), "w") as gradle_build_file:
|
||||||
@@ -175,7 +177,7 @@ if project_language == "java":
|
|||||||
|
|
||||||
### END Gradle build file changes for Java
|
### END Gradle build file changes for Java
|
||||||
|
|
||||||
### BEGIN *.java find and replace template package in all files
|
### BEGIN *.java find and replace template/example package in all files
|
||||||
# This regular expression trickery needs to be HEAVILY tested.
|
# This regular expression trickery needs to be HEAVILY tested.
|
||||||
# I don't think it's going to hold up everywhere...
|
# I don't think it's going to hold up everywhere...
|
||||||
|
|
||||||
@@ -185,7 +187,7 @@ if project_language == "java":
|
|||||||
# Note that because the last [option]* list doesn't include period, this
|
# Note that because the last [option]* list doesn't include period, this
|
||||||
# SHOULD ignore any continuing package structures after what we want to replace,
|
# SHOULD ignore any continuing package structures after what we want to replace,
|
||||||
# this is necessary as to not break command based templates
|
# this is necessary as to not break command based templates
|
||||||
template_regex = re.compile(r'edu\.wpi\.first\.wpilibj\.templates\.[a-zA-Z0-9]*')
|
template_regex = re.compile(r'edu\.wpi\.first\.wpilibj\.(templates|examples)\.[a-zA-Z0-9]*')
|
||||||
|
|
||||||
for file in glob.glob(os.path.join(new_project_path_src, "**", "*.java"), recursive=True):
|
for file in glob.glob(os.path.join(new_project_path_src, "**", "*.java"), recursive=True):
|
||||||
with open(file, "r") as java_file:
|
with open(file, "r") as java_file:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"workbench.colorTheme": "Visual Studio Dark",
|
"workbench.colorTheme": "Visual Studio Dark",
|
||||||
"java.jdt.ls.java.home": "/home/bradley/wpilib/2023/jdk",
|
"java.jdt.ls.java.home": "/home/coder/wpilib/###YEAR###/jdk",
|
||||||
"extensions.autoUpdate": false,
|
"extensions.autoUpdate": false,
|
||||||
"extensions.autoCheckUpdates": false,
|
"extensions.autoCheckUpdates": false,
|
||||||
"extensions.ignoreRecommendations": true,
|
"extensions.ignoreRecommendations": true,
|
||||||
|
|||||||
@@ -1,70 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
HELP() {
|
|
||||||
echo "----------------------------------------------------------"
|
|
||||||
echo "setup_cswpilib.sh [options] WPILIB_DL_URL"
|
|
||||||
echo "Install and setup code-server for WPILIB use"
|
|
||||||
echo "This script needs to be run as root!"
|
|
||||||
echo "Options:"
|
|
||||||
echo "\t-h: Show this help"
|
|
||||||
echo "\t-v: Make the script tell you more about what it is doing"
|
|
||||||
echo "----------------------------------------------------------"
|
|
||||||
echo ""
|
|
||||||
}
|
|
||||||
|
|
||||||
VERBOSE=false
|
|
||||||
|
|
||||||
while getopts "hv" flag; do
|
|
||||||
case "$flag" in
|
|
||||||
h)
|
|
||||||
Help
|
|
||||||
exit 0;;
|
|
||||||
v) VERBOSE=true;;
|
|
||||||
\?)
|
|
||||||
echo "Unknown option $flag, run setup_cswpilib.sh -h"
|
|
||||||
exit 1;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
WPILIB_DL_URL = ${@:$OPTIND:1}
|
|
||||||
|
|
||||||
if [ $WPILIB_DL_URL == '' ]; then
|
|
||||||
echo "You need to specify a WPILIB download URL"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $(whoami) != 'root' ]; then
|
|
||||||
echo "This script must be run as root"
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Installing code-server"
|
|
||||||
|
|
||||||
curl -fsSL https://code-server.dev/install.sh | sh
|
|
||||||
|
|
||||||
echo "Downloading WPILIB"
|
|
||||||
|
|
||||||
WPILIB_FILE_NAME="$(echo "$WPILIB_DL_URL" | grep -o '[^/]*$')"
|
|
||||||
|
|
||||||
curl -fsSL $WPILIB_DL_URL -o "/tmp/$WPILIB_FILE_NAME"
|
|
||||||
|
|
||||||
echo "Unpacking WPILIB"
|
|
||||||
|
|
||||||
tar -xzf "/tmp/$WPILIB_FILE_NAME" -C "/tmp"
|
|
||||||
|
|
||||||
echo "Unpacking WPILIB-artifacts"
|
|
||||||
|
|
||||||
WPILIB_ARTIFACTS=$(find /tmp -type f -name "WPILib_Linux-*-artifacts.tar.gz" -print)
|
|
||||||
|
|
||||||
if [ ! -d "/opt/wpilib" ]; then
|
|
||||||
mkdir -p /opt/wpilib
|
|
||||||
fi
|
|
||||||
|
|
||||||
tar -xzf "$WPILIB_ARTIFACTS" -C "/opt/wpilib"
|
|
||||||
|
|
||||||
find /tmp -type f -name "WPILibInstallerVersion.txt" -exec cp {} /opt/wpilib \;
|
|
||||||
|
|
||||||
echo "Cleanup excess WPILIB files"
|
|
||||||
|
|
||||||
rm -f /tmp/$WPILIB_FILE_NAME
|
|
||||||
rm -rf "$(find /tmp -type d -name "WPILib_Linux-*" -print)"
|
|
||||||
125
setup_user.sh
125
setup_user.sh
@@ -1,125 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
Help() {
|
|
||||||
echo "------------------------------------------------------------"
|
|
||||||
echo "setup_user.sh [options] USERNAME"
|
|
||||||
echo "Configure a new user on the system to use code-server WPILIB"
|
|
||||||
echo "This script needs to be run as root!"
|
|
||||||
echo "Options:"
|
|
||||||
echo "\t-h: Show this help"
|
|
||||||
echo "\t-v: Make the script tell you more about what it is doing"
|
|
||||||
echo "------------------------------------------------------------"
|
|
||||||
echo ""
|
|
||||||
}
|
|
||||||
|
|
||||||
VERBOSE=false
|
|
||||||
SCRIPTDIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
|
||||||
|
|
||||||
while getopts "hv" flag; do
|
|
||||||
case "$flag" in
|
|
||||||
h)
|
|
||||||
Help
|
|
||||||
exit 0;;
|
|
||||||
v) VERBOSE=true;;
|
|
||||||
\?)
|
|
||||||
echo "Unknown option $flag, run setup_user.sh -h"
|
|
||||||
exit 3;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
USERNAME=${@:$OPTIND:1}
|
|
||||||
PORT=${@:$OPTIND+1:1}
|
|
||||||
|
|
||||||
if [ $USERNAME == '' ]; then
|
|
||||||
echo "You need to specify a user to setup"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $(whoami) != 'root' ]; then
|
|
||||||
echo "This script must be run as root"
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$(grep -o "$USERNAME" /etc/passwd | uniq)" == "$USERNAME" ]; then
|
|
||||||
if $VERBOSE; then
|
|
||||||
echo "User $USERNAME already exists, skipping user creation"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
useradd "$USERNAME"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Unpacking WPILIB"
|
|
||||||
|
|
||||||
HOMEDIR="$(grep "$USERNAME" /etc/passwd | cut -d ':' -f 6)"
|
|
||||||
|
|
||||||
ARTIFACTSNAME="$(ls /opt/wpilib | grep artifacts)"
|
|
||||||
ARTIFACTSYEAR="$(echo $ARTIFACTSNAME | cut -d '-' -f 2 | cut -d '.' -f 1)"
|
|
||||||
|
|
||||||
if [ ! -d "$HOMEDIR/wpilib/$ARTIFACTSYEAR" ]; then
|
|
||||||
su -c "mkdir -p ~/wpilib/$ARTIFACTSYEAR" "$USERNAME"
|
|
||||||
fi
|
|
||||||
|
|
||||||
su -c "tar -xzf /opt/wpilib/$ARTIFACTSNAME -C ~/wpilib/$ARTIFACTSYEAR" "$USERNAME"
|
|
||||||
|
|
||||||
echo "Unpacking Gradle"
|
|
||||||
|
|
||||||
GRADLEZIP="$(ls $HOMEDIR/wpilib/$ARTIFACTSYEAR/installUtils | grep 'gradle-.*-bin.zip')"
|
|
||||||
GRADLEFOLDER="$HOMEDIR/gradle-$(echo "$GRADLEZIP" | cut -d '-' -f 2)"
|
|
||||||
|
|
||||||
su -c "unzip $HOMEDIR/wpilib/$ARTIFACTSYEAR/installUtils/$GRADLEZIP -d ~/" "$USERNAME"
|
|
||||||
|
|
||||||
echo "Setting up user environment variables"
|
|
||||||
|
|
||||||
if [ -f "$HOMEDIR/.bashrc.d/wpilib.sh" ]; then
|
|
||||||
rm -f "$HOMEDIR/.bashrc.d/wpilib.sh"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -d "$HOMEDIR/.bashrc.d" ]; then
|
|
||||||
su -c "mkdir $HOMEDIR/.bashrc.d" "$USERNAME"
|
|
||||||
fi
|
|
||||||
|
|
||||||
su -c "touch $HOMEDIR/.bashrc.d/wpilib.sh" "$USERNAME"
|
|
||||||
|
|
||||||
echo "export JAVA_HOME=$HOMEDIR/wpilib/$ARTIFACTSYEAR/jdk" >> "$HOMEDIR/.bashrc.d/wpilib.sh"
|
|
||||||
echo "export PATH=\$PATH:$HOMEDIR/wpilib/$ARTIFACTSYEAR/jdk/bin" >> "$HOMEDIR/.bashrc.d/wpilib.sh"
|
|
||||||
echo "export PATH=\$PATH:$GRADLEFOLDER/bin" >> "$HOMEDIR/.bashrc.d/wpilib.sh"
|
|
||||||
|
|
||||||
echo "Setting up tools"
|
|
||||||
|
|
||||||
su -c "$HOMEDIR/wpilib/$ARTIFACTSYEAR/jdk/bin/java -jar $HOMEDIR/wpilib/$ARTIFACTSYEAR/tools/ToolsUpdater.jar" "$USERNAME"
|
|
||||||
|
|
||||||
echo "Setting up maven"
|
|
||||||
|
|
||||||
su -c "$HOMEDIR/wpilib/$ARTIFACTSYEAR/jdk/bin/java -jar $HOMEDIR/wpilib/$ARTIFACTSYEAR/maven/MavenMetaDataFixer.jar" "$USERNAME"
|
|
||||||
|
|
||||||
echo "Setting up default code-server configs"
|
|
||||||
|
|
||||||
if [ ! -d "$HOMEDIR/.local/share" ]; then
|
|
||||||
su -c "mkdir -p ~/.local/share" "$USERNAME"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -d "$HOMEDIR/.config/code-server" ]; then
|
|
||||||
su -c "mkdir -p ~/.config/code-server" "$USERNAME"
|
|
||||||
fi
|
|
||||||
|
|
||||||
su -c "tar -xzf $SCRIPTDIR/code-server.tar.gz -C ~/.local/share" "$USERNAME"
|
|
||||||
su -c "cp -f $SCRIPTDIR/settings.json ~/.local/share/code-server/User" "$USERNAME"
|
|
||||||
su -c "cp -f $SCRIPTDIR/config.yaml ~/.config/code-server" "$USERNAME"
|
|
||||||
|
|
||||||
echo "Setting specific user configs"
|
|
||||||
|
|
||||||
IP="$(hostname -I | head -n 1 | tr -d ' ')"
|
|
||||||
NEW_PASS="$(tr -dc A-Za-z0-9 < /dev/urandom | head -c 20; echo)"
|
|
||||||
|
|
||||||
su -c "sed -i 's/IPADDRESS:PORT/$IP:$PORT/g;s/PASSWORD/$NEW_PASS/g;' ~/.config/code-server/config.yaml" "$USERNAME"
|
|
||||||
|
|
||||||
echo "Install user extensions"
|
|
||||||
|
|
||||||
for EXTENSION in $HOMEDIR/wpilib/$ARTIFACTSYEAR/vsCodeExtensions/*.vsix; do
|
|
||||||
echo "Installing extension $EXTENSION"
|
|
||||||
su -c "code-server --install-extension $EXTENSION" "$USERNAME"
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "$USERNAME is configured, there password is $NEW_PASS"
|
|
||||||
|
|
||||||
exit 0
|
|
||||||
Reference in New Issue
Block a user