-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
110 lines (93 loc) · 4.13 KB
/
Copy pathDockerfile
File metadata and controls
110 lines (93 loc) · 4.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# Copyright 2025 Alibaba Group Holding Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# THON - The Hackathon Organizer Node Sandbox Image
# This Dockerfile builds a sandbox image with code-server pre-installed
# for multi-instanceTHON hackathon environments.
#
# HTTPS Support:
# - By default, code-server runs over HTTP
# - For HTTPS, mount certificates and use: code-server --cert /certs/server.pem --cert-key /certs/server-key.pem
# - mkcert certificates can be generated on host and mounted into container
# Use the official Ubuntu 24.04 LTS base image
FROM ubuntu:24.04
# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
ENV PIP_NO_CACHE_DIR=1
# Install dependencies
RUN apt update && apt install -y --no-install-recommends \
curl \
wget \
git \
openssh-client \
gnupg \
lsb-release \
openssl \
ca-certificates \
vim \
nano \
sudo \
python3-full \
python3-m2crypto \
python3-gunicorn \
python3-djoser \
python3-jwt \
python3-dev \
python3-venv\
python3-pip \
python-is-python3 \
default-jre \
dotnet-sdk-10.0 \
chromium-browser
RUN wget -qO- https://deb.nodesource.com/setup_24.x | bash -
RUN apt install -y --no-install-recommends \
nodejs
RUN apt autoclean && apt autoremove
RUN rm -rf /var/lib/apt/lists/*
# Install Node Packages
RUN npm install -g pnpm opencode-plugin-langfuse playwright @kilocode/cli
# Install code-server
RUN curl -fsSL https://code-server.dev/install.sh | sh \
&& code-server --version
# Use Open VSX for extension marketplace
RUN PRODUCT_JSON="$(find /usr/lib/code-server -name product.json -path '*/lib/vscode/*' | head -1)" \
&& if [ -n "$PRODUCT_JSON" ]; then \
python3 -c "import json; f='$PRODUCT_JSON'; p=json.load(open(f)); p['extensionsGallery']={'serviceUrl':'https://open-vsx.org/vscode/gallery','cacheUrl':'','itemUrl':'https://open-vsx.org/vscode/item','controlUrl':'','recommendationsUrl':'', 'resourceUrlTemplate': 'https://open-vsx.org/vscode/unpkg/{publisher}/{name}/{version}/{path}', 'extensionUrlTemplate': 'https://open-vsx.org/vscode/gallery/{publisher}/{name}/latest'}; json.dump(p,open(f,'w'),indent=2)"; \
fi
# Create non-root user for security
RUN useradd -m -s /bin/bash vscode \
&& mkdir -p /workspace \
&& mkdir -p /certs \
&& chown -R vscode:vscode /workspace \
&& chown -R vscode:vscode /certs
# Set working directory
WORKDIR /workspace
# Switch to non-root user before installing extensions
# so they land in /home/vscode/.local/share/code-server/extensions/
USER vscode
# Install VS Code extensions from extensions.txt
COPY --chown=vscode:vscode config/extensions.txt /tmp/extensions.txt
RUN wget https://github.com/Kilo-Org/kilocode/releases/latest/download/kilo-vscode-linux-x64.vsix -O /tmp/kilo-vscode-linux-x64.vsix
RUN while IFS= read -r ext; do \
ext="$(echo "$ext" | tr -d '\r')"; \
[ -z "$ext" ] && continue; \
code-server --install-extension "$ext" --force || echo "WARNING: Failed to install $ext"; \
done < /tmp/extensions.txt \
&& code-server --install-extension /tmp/kilo-vscode-linux-x64.vsix --force || echo "WARNING: Failed to install Kilo Code" \
&& rm /tmp/kilo-vscode-linux-x64.vsix \
&& rm /tmp/extensions.txt
# Default command (HTTP mode by default)
# For HTTPS mode, mount certificates and run:
# code-server --cert /certs/server.pem --cert-key /certs/server-key.pem --bind-addr 0.0.0.0:44772 /workspace
CMD ["code-server", "--bind-addr", "0.0.0.0:8443", "--auth", "none", "--disable-telemetry", "/workspace"]