Skip to content

Commit 06383a2

Browse files
feat: add .ide Dockerfile; simplify main Dockerfile
Introduce .ide/Dockerfile to install JetBrains IDEs (GoLand, IntelliJ, PyCharm, WebStorm) and code-server with useful extensions; set LANG. Simplify the main Dockerfile by removing root/dev ARGs, ngrok installation, SSH configuration, and the custom /start.sh startup script; change CMD to /bin/bash and remove EXPOSE 22. Also remove docker-compose.yml. These changes move IDE-specific setup into a dedicated image and reduce extra services and default credentials from the base image.
1 parent 159d296 commit 06383a2

File tree

3 files changed

+38
-37
lines changed

3 files changed

+38
-37
lines changed

.ide/Dockerfile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
FROM node:22
2+
3+
WORKDIR /root
4+
5+
# 安装 ssh 服务
6+
RUN apt-get update && apt-get install -y wget unzip openssh-server
7+
8+
# 创建 /ide_cnb 目录,用于安装 IDE,注意安装路径必须是这个,便于自动识别环境中支持哪些 ide
9+
RUN mkdir -p /ide_cnb
10+
11+
# 安装 GoLand
12+
RUN wget https://download.jetbrains.com/go/goland-2025.3.3.tar.gz
13+
RUN tar -zxvf goland-2025.3.3.tar.gz -C /ide_cnb
14+
15+
# 安装 IntelliJ IDEA
16+
RUN wget https://download.jetbrains.com/idea/ideaIU-2025.3.3.tar.gz
17+
RUN tar -zxvf ideaIU-2025.3.3.tar.gz -C /ide_cnb
18+
19+
# 安装 PyCharm
20+
RUN wget https://download.jetbrains.com/python/pycharm-2025.3.3.tar.gz
21+
RUN tar -zxvf pycharm-2025.3.3.tar.gz -C /ide_cnb
22+
23+
# 安装 WebStorm
24+
RUN wget https://download.jetbrains.com/webstorm/WebStorm-2025.3.3.tar.gz
25+
RUN tar -zxvf WebStorm-2025.3.3.tar.gz -C /ide_cnb
26+
27+
# 安装 code-server(VSCode WebIDE 支持)
28+
RUN curl -fsSL https://code-server.dev/install.sh | sh \
29+
&& code-server --install-extension cnbcool.cnb-welcome \
30+
&& code-server --install-extension redhat.vscode-yaml \
31+
&& code-server --install-extension orta.vscode-jest \
32+
&& code-server --install-extension dbaeumer.vscode-eslint \
33+
&& code-server --install-extension waderyan.gitblame \
34+
&& code-server --install-extension mhutchie.git-graph \
35+
&& code-server --install-extension donjayamanne.githistory
36+
37+
ENV LANG C.UTF-8

Dockerfile

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ FROM ubuntu:latest
33
ENV DEBIAN_FRONTEND=noninteractive
44
ENV TZ=Asia/Shanghai
55

6-
ARG ROOT_PASSWORD=123456
7-
ARG DEV_USERNAME=pleasure
8-
ARG DEV_PASSWORD=123456
9-
106
# 安装系统依赖需求
117
RUN apt-get update && apt-get upgrade -y && apt-get install -y \
128
neofetch \
@@ -174,38 +170,6 @@ RUN echo "=== Environment Setup Complete ===" \
174170
&& echo "\nMaven Version:" && mvn -version \
175171
&& echo "\nGo Version:" && go version
176172

177-
# 安装 ngrok
178-
RUN echo "=== Installing ngrok ===" \
179-
&& curl -s https://ngrok-agent.s3.amazonaws.com/ngrok.asc | tee /etc/apt/trusted.gpg.d/ngrok.asc \
180-
&& echo "deb https://ngrok-agent.s3.amazonaws.com buster main" | tee /etc/apt/sources.list.d/ngrok.list \
181-
&& apt-get update \
182-
&& apt-get install ngrok \
183-
&& echo "ngrok installed successfully" \
184-
&& ngrok version
185-
186-
# This base image contains only the development environment
187-
188-
# 配置 SSH 服务
189-
RUN echo "PermitRootLogin yes" >> /etc/ssh/sshd_config \
190-
&& echo "PasswordAuthentication yes" >> /etc/ssh/sshd_config \
191-
&& mkdir -p /var/run/sshd \
192-
&& echo 'root:123456' | chpasswd \
193-
&& sed -i 's/#PermitEmptyPasswords no/PermitEmptyPasswords yes/' /etc/ssh/sshd_config
194-
195-
# 创建启动脚本
196-
RUN echo '#!/bin/bash' > /start.sh \
197-
&& echo 'echo "Starting SSH service..."' >> /start.sh \
198-
&& echo '/usr/sbin/sshd' >> /start.sh \
199-
&& echo 'echo "SSH service started on port 22"' >> /start.sh \
200-
&& echo 'echo "Base development environment is ready."' >> /start.sh \
201-
&& echo 'echo "SSH access: root@localhost -p 22"' >> /start.sh \
202-
&& echo 'exec /bin/bash' >> /start.sh \
203-
&& chmod +x /start.sh
204-
205173
WORKDIR /workspace
206174

207-
# 暴露 SSH 端口
208-
EXPOSE 22
209-
210-
# 启动 SSH 服务并运行 bash
211-
CMD ["/start.sh"]
175+
CMD ["/bin/bash"]

docker-compose.yml

Whitespace-only changes.

0 commit comments

Comments
 (0)