Skip to content

Commit a246096

Browse files
Add IDE Dockerfiles, enhance base image
Introduces Dockerfile.ide for AI coding tools and IDEs as a base for Minecraft-related development. Updates the main Dockerfile to add SSH, ngrok, and startup scripts, and exposes port 22. Updates GitHub Actions workflow to build and push the new images. Adds .env.example and docker-compose.yml for environment configuration, and updates README with new usage instructions and TODOs.
1 parent c8cdc04 commit a246096

File tree

7 files changed

+195
-21
lines changed

7 files changed

+195
-21
lines changed

.env.example

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## Server Environment Variables
2+
ROOT_PASSWORD=123456
3+
DEV_USERNAME=pleasure
4+
DEV_PASSWORD=123456
5+
TZ=Asia/Shanghai
6+
7+
## Service Secrets

.github/workflows/publish.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ on:
66
- main
77
paths:
88
- 'Dockerfile'
9+
- 'Dockerfile.ide'
910
tags:
1011
- 'v*'
1112
pull_request:
1213
branches:
1314
- main
1415
paths:
1516
- 'Dockerfile'
17+
- 'Dockerfile.ide'
1618
workflow_dispatch:
1719

1820
env:
@@ -55,10 +57,24 @@ jobs:
5557
type=sha,prefix={{branch}}-
5658
type=raw,value=latest,enable={{is_default_branch}}
5759
58-
- name: Build and push Docker image
60+
- name: Build base image using Dockerfile
5961
uses: docker/build-push-action@v6
6062
with:
6163
context: .
64+
file: ./Dockerfile
65+
push: false
66+
load: true
67+
tags: base-image:latest
68+
labels: ${{ steps.meta.outputs.labels }}
69+
cache-from: type=gha
70+
cache-to: type=gha,mode=max
71+
platforms: linux/amd64
72+
73+
- name: Build and push IDE image using Dockerfile.ide
74+
uses: docker/build-push-action@v6
75+
with:
76+
context: .
77+
file: ./Dockerfile.ide
6278
push: ${{ github.event_name != 'pull_request' }}
6379
tags: ${{ steps.meta.outputs.tags }}
6480
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ 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+
610
# 安装系统依赖需求
711
RUN apt-get update && apt-get upgrade -y && apt-get install -y \
812
neofetch \
@@ -22,6 +26,8 @@ RUN apt-get update && apt-get upgrade -y && apt-get install -y \
2226
software-properties-common \
2327
zip \
2428
unzip \
29+
net-tools \
30+
openssh-server \
2531
libbz2-dev \
2632
libreadline-dev \
2733
libsqlite3-dev \
@@ -155,6 +161,40 @@ RUN echo "=== Environment Setup Complete ===" \
155161
&& echo "\nMaven Version:" && mvn -version \
156162
&& echo "\nGo Version:" && go version
157163

164+
# 安装 ngrok
165+
RUN echo "=== Installing ngrok ===" \
166+
&& curl -s https://ngrok-agent.s3.amazonaws.com/ngrok.asc | sudo tee /etc/apt/trusted.gpg.d/ngrok.asc \
167+
&& echo "deb https://ngrok-agent.s3.amazonaws.com buster main" | sudo tee /etc/apt/sources.list.d/ngrok.list \
168+
&& sudo apt-get update \
169+
&& sudo apt-get install ngrok \
170+
&& echo "ngrok installed successfully" \
171+
&& ngrok version
172+
173+
# Note: AI coding tools, VSCode Server, and JetBrains IDEs is in Dockerfile.ide
174+
# This base image contains only the development environment
175+
176+
# 配置 SSH 服务
177+
RUN echo "PermitRootLogin yes" >> /etc/ssh/sshd_config \
178+
&& echo "PasswordAuthentication yes" >> /etc/ssh/sshd_config \
179+
&& mkdir -p /var/run/sshd \
180+
&& echo 'root:123456' | chpasswd \
181+
&& sed -i 's/#PermitEmptyPasswords no/PermitEmptyPasswords yes/' /etc/ssh/sshd_config
182+
183+
# 创建启动脚本
184+
RUN echo '#!/bin/bash' > /start.sh \
185+
&& echo 'echo "Starting SSH service..."' >> /start.sh \
186+
&& echo '/usr/sbin/sshd' >> /start.sh \
187+
&& echo 'echo "SSH service started on port 22"' >> /start.sh \
188+
&& echo 'echo "Base development environment is ready."' >> /start.sh \
189+
&& echo 'echo "For IDE support, use Dockerfile.ide image."' >> /start.sh \
190+
&& echo 'echo "SSH access: root@localhost -p 22"' >> /start.sh \
191+
&& echo 'exec /bin/bash' >> /start.sh \
192+
&& chmod +x /start.sh
193+
158194
WORKDIR /workspace
159195

160-
CMD ["/bin/bash"]
196+
# 暴露 SSH 端口
197+
EXPOSE 22
198+
199+
# 启动 SSH 服务并运行 bash
200+
CMD ["/start.sh"]

Dockerfile.ide

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
FROM ghcr.io/pleasurecruise/my-env:latest
2+
3+
# 设置环境变量
4+
ENV DEBIAN_FRONTEND=noninteractive
5+
ENV TZ=Asia/Shanghai
6+
7+
# 重新获取环境变量(由于基于已构建镜像)
8+
ENV NVM_DIR=/root/.nvm
9+
ENV NODE_VERSION=24
10+
ENV PYENV_ROOT=/root/.pyenv
11+
ENV CONDA_DIR=/opt/conda
12+
ENV SDKMAN_DIR=/root/.sdkman
13+
ENV MAVEN_HOME=/opt/maven
14+
ENV JAVA_HOME=$SDKMAN_DIR/candidates/java/current
15+
ENV GOPATH=/root/go
16+
17+
# 更新 PATH 环境变量
18+
ENV PATH=$NVM_DIR/versions/node/v$NODE_VERSION.0.0/bin:$PYENV_ROOT/shims:$PYENV_ROOT/bin:$CONDA_DIR/bin:$JAVA_HOME/bin:$MAVEN_HOME/bin:/usr/local/go/bin:$GOPATH/bin:$PATH
19+
20+
# 安装 AI 编程工具
21+
RUN echo "=== Installing AI Coding Tools ===" \
22+
&& . "$NVM_DIR/nvm.sh" \
23+
&& echo "Installing @anthropic-ai/claude-code..." \
24+
&& npm install -g @anthropic-ai/claude-code \
25+
&& echo "Installing @openai/codex..." \
26+
&& npm install -g @openai/codex \
27+
&& echo "Installing @google/gemini-cli..." \
28+
&& npm install -g @google/gemini-cli \
29+
&& echo "Installing @qwen-code/qwen-code..." \
30+
&& npm install -g @qwen-code/qwen-code \
31+
&& echo "Installing @github/copilot..." \
32+
&& npm install -g @github/copilot@latest
33+
34+
# 安装 VSCode Server
35+
RUN echo "=== Installing VSCode Server ===" \
36+
&& mkdir -p /root/.vscode-server \
37+
&& curl -fsSL https://code-server.dev/install.sh | sh \
38+
&& echo "Installing VSCode extensions..." \
39+
&& code-server --install-extension ms-python.python \
40+
&& code-server --install-extension ms-vscode.cpptools \
41+
&& code-server --install-extension ms-vscode.vscode-typescript-next \
42+
&& code-server --install-extension bradlc.vscode-tailwindcss \
43+
&& code-server --install-extension GitHub.vscode-pull-request-github \
44+
&& code-server --install-extension GitHub.copilot \
45+
&& code-server --install-extension GitHub.copilot-chat \
46+
&& code-server --install-extension Vue.volar \
47+
&& code-server --install-extension Vue.vscode-typescript-vue-plugin \
48+
&& code-server --install-extension Expo.vscode-expo-tools \
49+
&& code-server --install-extension vscodevim.vim \
50+
&& echo "Creating VSCode Server configuration..." \
51+
&& mkdir -p /root/.config/code-server \
52+
&& echo '{"bind-addr": "0.0.0.0:8080", "auth": "password", "password": "123456", "cert": false}' > /root/.config/code-server/config.yaml \
53+
&& echo "VSCode Server will be available on port 8080"
54+
55+
# 安装 JetBrains IDEs
56+
RUN echo "=== Installing JetBrains IDEs ===" \
57+
&& mkdir -p /root/.local/share/JetBrains/Toolbox/apps \
58+
&& echo "Downloading WebStorm..." \
59+
&& wget -O /tmp/WebStorm.tar.gz "https://data.services.jetbrains.com/products/download?code=WS&platform=linux" \
60+
&& mkdir -p /root/.local/share/JetBrains/Toolbox/apps/webstorm \
61+
&& tar -xzf /tmp/WebStorm.tar.gz -C /root/.local/share/JetBrains/Toolbox/apps/webstorm --strip-components=1 \
62+
&& rm /tmp/WebStorm.tar.gz \
63+
&& echo "Downloading IntelliJ IDEA Ultimate..." \
64+
&& wget -O /tmp/IntelliJIDEA.tar.gz "https://data.services.jetbrains.com/products/download?code=IU&platform=linux" \
65+
&& mkdir -p /root/.local/share/JetBrains/Toolbox/apps/intellij-idea-ultimate \
66+
&& tar -xzf /tmp/IntelliJIDEA.tar.gz -C /root/.local/share/JetBrains/Toolbox/apps/intellij-idea-ultimate --strip-components=1 \
67+
&& rm /tmp/IntelliJIDEA.tar.gz \
68+
&& echo "Downloading PyCharm Professional..." \
69+
&& wget -O /tmp/PyCharm.tar.gz "https://data.services.jetbrains.com/products/download?code=PCP&platform=linux" \
70+
&& mkdir -p /root/.local/share/JetBrains/Toolbox/apps/pycharm \
71+
&& tar -xzf /tmp/PyCharm.tar.gz -C /root/.local/share/JetBrains/Toolbox/apps/pycharm --strip-components=1 \
72+
&& rm /tmp/PyCharm.tar.gz \
73+
&& echo "Downloading GoLand..." \
74+
&& wget -O /tmp/GoLand.tar.gz "https://data.services.jetbrains.com/products/download?code=GO&platform=linux" \
75+
&& mkdir -p /root/.local/share/JetBrains/Toolbox/apps/goland \
76+
&& tar -xzf /tmp/GoLand.tar.gz -C /root/.local/share/JetBrains/Toolbox/apps/goland --strip-components=1 \
77+
&& rm /tmp/GoLand.tar.gz \
78+
&& echo "=== JetBrains IDEs Installation Complete ===" \
79+
&& echo "WebStorm installed in: /root/.local/share/JetBrains/Toolbox/apps/webstorm" \
80+
&& echo "IntelliJ IDEA Ultimate installed in: /root/.local/share/JetBrains/Toolbox/apps/intellij-idea-ultimate" \
81+
&& echo "PyCharm Professional installed in: /root/.local/share/JetBrains/Toolbox/apps/pycharm" \
82+
&& echo "GoLand installed in: /root/.local/share/JetBrains/Toolbox/apps/goland"
83+
84+
# 添加 JetBrains IDEs 到 PATH
85+
RUN echo '' >> /root/.bashrc \
86+
&& echo '# JetBrains IDEs configuration' >> /root/.bashrc \
87+
&& echo 'export PATH="/root/.local/share/JetBrains/Toolbox/apps/webstorm/bin:$PATH"' >> /root/.bashrc \
88+
&& echo 'export PATH="/root/.local/share/JetBrains/Toolbox/apps/intellij-idea-ultimate/bin:$PATH"' >> /root/.bashrc \
89+
&& echo 'export PATH="/root/.local/share/JetBrains/Toolbox/apps/pycharm/bin:$PATH"' >> /root/.bashrc \
90+
&& echo 'export PATH="/root/.local/share/JetBrains/Toolbox/apps/goland/bin:$PATH"' >> /root/.bashrc
91+
92+
# 安装 Vercel CLI 和 GitHub CLI
93+
RUN echo "=== Installing Vercel CLI and GitHub CLI ===" \
94+
&& . "$NVM_DIR/nvm.sh" \
95+
&& echo "Installing Vercel CLI..." \
96+
&& npm install -g vercel \
97+
&& echo "Installing GitHub CLI..." \
98+
&& curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
99+
&& chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
100+
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
101+
&& apt-get update \
102+
&& apt-get install -y gh \
103+
&& echo "Vercel CLI and GitHub CLI installed successfully" \
104+
&& echo "Vercel CLI version:" && vercel --version \
105+
&& echo "GitHub CLI version:" && gh --version
106+
107+
# 设置工作目录
108+
WORKDIR /workspace
109+
110+
# 显示安装完成信息
111+
RUN echo "=== AI Coding Tools and IDEs Installation Complete ===" \
112+
&& echo "Installed tools:" \
113+
&& echo "- Claude Code: @anthropic-ai/claude-code" \
114+
&& echo "- OpenAI Codex: @openai/codex" \
115+
&& echo "- Google Gemini CLI: @google/gemini-cli" \
116+
&& echo "- Qwen Code: @qwen-code/qwen-code" \
117+
&& echo "- GitHub Copilot: @github/copilot" \
118+
&& echo "- VSCode Server with extensions" \
119+
&& echo "- JetBrains IDEs: WebStorm, IntelliJ IDEA Ultimate, PyCharm Professional, GoLand" \
120+
&& echo "" \
121+
&& echo "Container is ready for AI-powered development"

Dockerfile.minecraft

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
FROM ghcr.io/pleasurecruise/my-env:latest
2+

README.md

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ Docker can be useful to ensure your website works on the same on any machine
88

99
add following config file to the repo before use
1010

11+
p.s. vercel does not support docker useage
12+
1113
## github codespace useage
1214

1315
```
@@ -37,23 +39,6 @@ $:
3739
script: ls
3840
```
3941

40-
## vercel deploy useage
41-
42-
```
43-
# vercel.json
44-
{
45-
"builds": [
46-
{ "src": "Dockerfile",
47-
"use": "@vercel/docker",
48-
"config": {
49-
"buildCommand": "docker build -t my-env:latest .",
50-
"pushCommand": "docker push my-env:latest"
51-
}
52-
}
53-
]
54-
}
55-
```
56-
5742
## jetbrains devcontainer & other servers useage
5843

5944
Copy `Dockerfile` to the target repo folder
@@ -62,5 +47,8 @@ Create New Dev Container from Dockerfile under the repo folder
6247

6348
## TODO
6449

65-
-[ ] add ide configuration
66-
- [ ] add cli configuration
50+
-[ ] 添加.env外部运行时密钥
51+
52+
-[ ] 暴露ssh codespace到外部端口
53+
54+
-[ ] 基于my-env尝试编写dockerfile.minecraft

docker-compose.yml

Whitespace-only changes.

0 commit comments

Comments
 (0)