mirror of
https://github.com/gurucomputing/headscale-ui.git
synced 2026-01-23 02:34:43 +00:00
moved dev image to node base image
This commit is contained in:
parent
dfc1f5b098
commit
fdac9177da
3 changed files with 18 additions and 30 deletions
|
|
@ -1,8 +1,7 @@
|
|||
FROM fedora:36
|
||||
FROM node:latest
|
||||
|
||||
# Arguments
|
||||
ARG OPENVSCODE_VERSION="1.68.1"
|
||||
ARG NODEJS_VERSION="16"
|
||||
# Volumes
|
||||
VOLUME /data
|
||||
|
||||
|
|
@ -15,7 +14,7 @@ EXPOSE 443
|
|||
# System Environment Variables
|
||||
ENV PATH="/opt/vscode:${PATH}"
|
||||
ENV HOME="/data/home"
|
||||
ENV SHELL="/usr/bin/fish"
|
||||
ENV SHELL="/bin/bash"
|
||||
|
||||
# User Set Environment Variables
|
||||
# Set to false if you do not want to attempt to pull a repository on first load
|
||||
|
|
@ -50,7 +49,7 @@ RUN chmod -R 755 scripts
|
|||
RUN /staging/scripts/1-image-build.sh
|
||||
|
||||
# set to the non-root user
|
||||
USER nodejs
|
||||
USER node
|
||||
|
||||
WORKDIR /data
|
||||
|
||||
|
|
|
|||
|
|
@ -7,29 +7,18 @@ set -x
|
|||
# script variables
|
||||
OPENVSCODE_URL="https://github.com/gitpod-io/openvscode-server/releases/download/openvscode-server-v$OPENVSCODE_VERSION/openvscode-server-v$OPENVSCODE_VERSION-linux-x64.tar.gz"
|
||||
OPENVSCODE_RELEASE="openvscode-server-v$OPENVSCODE_VERSION-linux-x64"
|
||||
CADDY_URL="https://caddyserver.com/api/download?os=linux&arch=amd64"
|
||||
|
||||
# install dependencies
|
||||
# ncurses basic command line QOL improvements
|
||||
# tmux used for monitoring secondary processes
|
||||
# git It's git!
|
||||
# fish prettier shell
|
||||
# caddy file server for stage testing
|
||||
dnf install -y ncurses tmux git fish caddy
|
||||
|
||||
# Add the ability to set file permissions on /data to the non-privileged user
|
||||
echo "ALL ALL=NOPASSWD: /bin/chown -R 1000\:1000 /data" >> /etc/sudoers
|
||||
|
||||
# install nodejs
|
||||
dnf module install -y nodejs:${NODEJS_VERSION}
|
||||
|
||||
# create the non-root user
|
||||
groupadd -g 1000 nodejs
|
||||
useradd -u 1000 -g 1000 nodejs
|
||||
# tmux used for monitoring secondary processes
|
||||
# sudo for running specific commands as root
|
||||
apt-get update
|
||||
apt-get install -y tmux sudo
|
||||
|
||||
# set the default shell to the chosen shell
|
||||
usermod --shell ${SHELL} nodejs
|
||||
usermod --shell ${SHELL} node
|
||||
|
||||
# Add the ability to set file permissions to the non-privileged user
|
||||
# Add the ability to set file permissions on /data to the non-privileged user
|
||||
echo "ALL ALL=NOPASSWD: /bin/chown -R 1000\:1000 /data" >> /etc/sudoers
|
||||
|
||||
# install openVSCode
|
||||
|
|
@ -43,6 +32,11 @@ tar -xzf "$OPENVSCODE_RELEASE.tar.gz"
|
|||
mv $OPENVSCODE_RELEASE openvscode-server
|
||||
rm -f "$OPENVSCODE_RELEASE.tar.gz"
|
||||
|
||||
### download caddy
|
||||
curl -LJO "$CADDY_URL"
|
||||
chmod +x caddy_linux_amd64
|
||||
mv caddy_linux_amd64 /usr/bin/caddy
|
||||
|
||||
# create data and home directories
|
||||
mkdir -p /data/home
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ then
|
|||
fi
|
||||
|
||||
#attempt to initialize and run a repository
|
||||
if [[ "$AUTOINITIALIZE" == "true" ]]
|
||||
if [ "$AUTOINITIALIZE" = "true" ]
|
||||
then
|
||||
# check if there is a copy of ${PROJECT_NAME}, if not assume this is a fresh install
|
||||
if ! [ -d /data/${PROJECT_NAME} ]
|
||||
|
|
@ -45,7 +45,7 @@ then
|
|||
cd /data/${PROJECT_NAME}
|
||||
fi
|
||||
|
||||
if [[ "$AUTOSTART" == "true" ]]
|
||||
if [ "$AUTOSTART" = "true" ]
|
||||
then
|
||||
# run the sub process
|
||||
tmux new-session -d "${DEV_COMMAND}; sh"
|
||||
|
|
@ -53,14 +53,9 @@ then
|
|||
fi
|
||||
|
||||
# run the main process.
|
||||
if [[ "$USE_CONNECTION_TOKEN" == "false" ]]
|
||||
if [ "$USE_CONNECTION_TOKEN" = "false" ]
|
||||
then
|
||||
/opt/openvscode-server/bin/openvscode-server --host 0.0.0.0 --without-connection-token
|
||||
else
|
||||
if [[ "$CONNECTION_TOKEN" == "" ]]
|
||||
then
|
||||
CONNECTION_TOKEN=$(echo $RANDOM | md5sum | head -c 20)
|
||||
echo "connection token is not set, randomising to $CONNECTION_TOKEN"
|
||||
fi
|
||||
/opt/openvscode-server/bin/openvscode-server --host 0.0.0.0 --connection-token=${CONNECTION_TOKEN}
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue