Skip to content

Commit cee7031

Browse files
committed
Build scripts for custom Golden Helix build of code-server
1 parent d911eac commit cee7031

9 files changed

+203
-3
lines changed

.dockerignore

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
**
22
!release-packages
33
!ci
4+
!release-standalone
5+
!startup.sh
6+
!install_locales.sh

Dockerfile

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
ARG SERVER_VERSION=20241223_895aa2908981
2+
FROM registry.goldenhelix.com/gh/server:${SERVER_VERSION}
3+
4+
USER root
5+
6+
# Install various locales to support users from different regions
7+
COPY ./install_locales.sh /tmp/install_locales.sh
8+
RUN bash /tmp/install_locales.sh
9+
10+
# Copy the release-standalone directory
11+
COPY ./release-standalone /opt/code-server
12+
COPY ./startup.sh /opt/code-server/startup.sh
13+
14+
# Remove the existing node binary and create symlink to the system node
15+
RUN rm -f /opt/code-server/lib/node && \
16+
ln -s /opt/node/bin/node /opt/code-server/lib/node && \
17+
chmod +x /opt/code-server/startup.sh
18+
19+
# Set the environment variables
20+
ARG LANG='en_US.UTF-8'
21+
ARG LANGUAGE='en_US:en'
22+
ARG LC_ALL='en_US.UTF-8'
23+
ARG START_XFCE4=1
24+
ARG TZ='Etc/UTC'
25+
ENV HOME=/home/ghuser \
26+
SHELL=/bin/bash \
27+
USERNAME=ghuser \
28+
LANG=$LANG \
29+
LANGUAGE=$LANGUAGE \
30+
LC_ALL=$LC_ALL \
31+
TZ=$TZ \
32+
AUTH_USER=ghuser \
33+
CODE_SERVER_SESSION_SOCKET=/home/ghuser/.config/code-server/code-server-ipc.sock \
34+
PASSWORD=ghuserpassword \
35+
PORT=8080
36+
37+
### Ports and user
38+
EXPOSE $PORT
39+
WORKDIR $HOME
40+
USER 1000
41+
42+
RUN mkdir -p $HOME/.config/code-server && \
43+
echo "bind-addr: 0.0.0.0:8080" > $HOME/.config/code-server/config.yaml && \
44+
echo "auth: password" >> $HOME/.config/code-server/config.yaml && \
45+
echo "password: \${PASSWORD}" >> $HOME/.config/code-server/config.yaml && \
46+
echo "cert: true" >> $HOME/.config/code-server/config.yaml
47+
48+
49+
RUN mkdir -p $HOME/Workspace/Documents
50+
51+
ENTRYPOINT ["/opt/code-server/startup.sh"]

build.sh

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
3+
# Build a Golden Helix docker image for code-server with changes to support App Streaming on VSWarehouse
4+
5+
# Follow the directions under [CONTRIBUTING.md](docs/CONTRIBUTING.md) to build the image
6+
7+
# git submodule update --init
8+
# quilt push -a
9+
# npm install
10+
# npm run build
11+
# VERSION=4.96.2 npm run build:vscode
12+
# npm run release
13+
14+
# VERSION=4.96.2 npm run package
15+
# cd release
16+
# npm install --omit=dev
17+
# cd ..
18+
# npm run release:standalone
19+
20+
export VERSION=4.96.2
21+
22+
export SERVER_VERSION=20241223_895aa2908981
23+
24+
# Ensure we're in the correct directory
25+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
26+
cd "$SCRIPT_DIR"
27+
28+
# Temporarily move the bundled node out of the way
29+
if [ -f "release-standalone/lib/node" ]; then
30+
mv release-standalone/lib/node ./node
31+
fi
32+
33+
echo "PWD: $PWD"
34+
35+
docker build --no-cache \
36+
--build-arg SERVER_VERSION=${SERVER_VERSION} \
37+
-t registry.goldenhelix.com/gh/code-server:${VERSION} .
38+
39+
# Move the bundled node back
40+
if [ -f "./node" ]; then
41+
mv ./node release-standalone/lib/node
42+
fi
43+
44+
# Run like
45+
# docker run -it -p 8081:8080 -e PASSWORD=your_secure_password123 -e PORT=8080 registry.goldenhelix.com/gh/code-server:20241223_895aa2908981 /home/ghuser/Workspace/

extensions.txt

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
github.copilot
2+
github.copilot-chat
3+
hashicorp.terraform
4+
ms-python.debugpy
5+
ms-python.python
6+
ms-python.vscode-pylance
7+
ms-toolsai.jupyter
8+
ms-toolsai.jupyter-keymap
9+
ms-toolsai.jupyter-renderers
10+
ms-toolsai.vscode-jupyter-cell-tags
11+
ms-toolsai.vscode-jupyter-slideshow
12+
ms-vscode-remote.remote-containers
13+
stkb.rewrap
14+
streetsidesoftware.code-spell-checker
15+
redhat.vscode-yaml

install_locales.sh

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
# *GH* selected major languages for space and time
3+
LOCALES="de_DE fr_FR it_IT es_ES en_GB nl_NL sv_SE pl_PL fr_BE nl_BE de_AT da_DK fi_FI el_GR en_IE pt_PT cs_CZ hu_HU ro_RO bg_BG ja_JP zh_CN ko_KR hi_IN ru_RU"
4+
5+
echo "Installing languages"
6+
apt-get update
7+
apt-get install -y \
8+
locales locales-all
9+
for LOCALE in ${LOCALES}; do
10+
echo "Generating Locale for ${LOCALE}"
11+
localedef -i ${LOCALE} -f UTF-8 ${LOCALE}.UTF-8
12+
done

install_system_extensions.sh

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
3+
EXTENSIONS_FILE="./extensions.txt"
4+
CODE_SERVER="./release-standalone/bin/code-server"
5+
EXTENSIONS_DIR="~/.local/share/code-server/extensions"
6+
TARGET_DIR="./release-standalone/lib/vscode/extensions"
7+
8+
# Check if code-server exists
9+
if [ ! -f "$CODE_SERVER" ]; then
10+
echo "Error: code-server not found at $CODE_SERVER"
11+
exit 1
12+
fi
13+
14+
# Create target directory if it doesn't exist
15+
mkdir -p "$TARGET_DIR"
16+
17+
# Read extensions file line by line
18+
while IFS= read -r extension || [ -n "$extension" ]; do
19+
# Skip empty lines and comments
20+
if [[ -z "$extension" || "$extension" =~ ^# ]]; then
21+
continue
22+
fi
23+
24+
echo "Installing extension: $extension"
25+
26+
# Install the extension
27+
$CODE_SERVER --install-extension "$extension"
28+
29+
if [ $? -ne 0 ]; then
30+
echo "Warning: Failed to install $extension"
31+
continue
32+
fi
33+
34+
echo "Copying extension files to standalone directory"
35+
# Use cp -R with expanded source path
36+
if ! eval "cp -R $EXTENSIONS_DIR/${extension}* $TARGET_DIR/"; then
37+
echo "Warning: Failed to copy $extension to standalone directory"
38+
fi
39+
40+
echo "Completed processing $extension"
41+
echo "----------------------------------------"
42+
done < "$EXTENSIONS_FILE"
43+
44+
echo "All extensions processed"

package-lock.json

+5-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
"safe-buffer": "^5.2.1",
8787
"safe-compare": "^1.1.4",
8888
"semver": "^7.5.4",
89+
"tslib": "^2.8.1",
8990
"ws": "^8.14.2",
9091
"xdg-basedir": "^4.0.0"
9192
},

startup.sh

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
3+
# Try to set up the private (per user) User Data folder
4+
set +e
5+
mkdir -p $HOME/Workspace/Documents/$USERNAME/code-server
6+
export XDG_DATA_HOME=$HOME/Workspace/Documents/$USERNAME
7+
set -e
8+
9+
echo 'export PS1="$USERNAME:\w\$ "' >> $HOME/.bashrc
10+
11+
# Set the default project folder
12+
DEFAULT_PROJECT_FOLDER="$HOME/Workspace/"
13+
14+
# Use the provided PROJECT_FOLDER or default to DEFAULT_PROJECT_FOLDER
15+
STARTING_FOLDER="${PROJECT_FOLDER:-$DEFAULT_PROJECT_FOLDER}"
16+
17+
# Your script logic here
18+
echo "Starting in folder: $STARTING_FOLDER"
19+
20+
/opt/code-server/bin/code-server \
21+
--disable-telemetry \
22+
--disable-update-check \
23+
--disable-workspace-trust \
24+
--locale=$LANG \
25+
--welcome-text="Welcome to your Golden Helix VSCode environment" \
26+
--ignore-last-opened \
27+
$STARTING_FOLDER

0 commit comments

Comments
 (0)