Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +17 -20
Dockerfile
CHANGED
|
@@ -17,28 +17,29 @@ RUN apt-get update && apt-get install -y && \
|
|
| 17 |
curl -fsSL https://code-server.dev/install.sh | sh
|
| 18 |
|
| 19 |
# 安装frpc
|
| 20 |
-
RUN cd /usr/local/bin && \
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
|
| 26 |
# 配置frpc与codeserver同时运行
|
| 27 |
RUN echo '#!/bin/bash\n\
|
| 28 |
# ===== 从环境变量配置Git身份和凭证 =====\n\
|
| 29 |
-
if [ -n \"${GH_USERNAME}\" ] && [ -n \"${GH_EMAIL}\" ]; then\n\
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
fi\n\
|
| 34 |
-
if [ -n \"${GH_TOKEN}\" ]; then\n\
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
fi\n\
|
| 39 |
# 1. 启动 frpc (后台运行)\n\
|
| 40 |
-
/usr/local/bin/frpc -f ${FRP_TOKEN} &\n\
|
| 41 |
# 2. 前台启动 code-server (保持容器运行)\n\
|
|
|
|
| 42 |
exec code-server /home/coder/cpp_competition' > /home/coder/start.sh
|
| 43 |
RUN chmod +x /home/coder/start.sh
|
| 44 |
|
|
@@ -67,10 +68,6 @@ RUN code-server --install-extension /home/coder/cph-ng-0.5.5.vsix && \
|
|
| 67 |
code-server --install-extension llvm-vs-code-extensions.vscode-clangd
|
| 68 |
|
| 69 |
RUN /home/coder/create_languagepacks.sh
|
| 70 |
-
|
| 71 |
-
# 配置git
|
| 72 |
-
RUN git clone https://github.com/Save-it/cpp_competition.git /home/coder/cpp_competition && \
|
| 73 |
-
echo '*.exe \n *.out' > /home/coder/cpp_competition/.gitignore
|
| 74 |
|
| 75 |
# 暴露端口
|
| 76 |
EXPOSE 8080
|
|
|
|
| 17 |
curl -fsSL https://code-server.dev/install.sh | sh
|
| 18 |
|
| 19 |
# 安装frpc
|
| 20 |
+
# RUN cd /usr/local/bin && \
|
| 21 |
+
# wget -O /usr/local/bin/frpc https://nya.globalslb.net/natfrp/client/frpc/0.51.0-sakura-12.3/frpc_linux_amd64 && \
|
| 22 |
+
# chmod 755 /usr/local/bin/frpc && \
|
| 23 |
+
# ls -l /usr/local/bin/frpc && \
|
| 24 |
+
# md5sum /usr/local/bin/frpc
|
| 25 |
|
| 26 |
# 配置frpc与codeserver同时运行
|
| 27 |
RUN echo '#!/bin/bash\n\
|
| 28 |
# ===== 从环境变量配置Git身份和凭证 =====\n\
|
| 29 |
+
# if [ -n \"${GH_USERNAME}\" ] && [ -n \"${GH_EMAIL}\" ]; then\n\
|
| 30 |
+
# git config --global user.name \"${GH_USERNAME}\"\n\
|
| 31 |
+
# git config --global user.email \"${GH_EMAIL}\"\n\
|
| 32 |
+
# echo \"Git用户身份已从环境变量设置。\"\n\
|
| 33 |
+
# fi\n\
|
| 34 |
+
# if [ -n \"${GH_TOKEN}\" ]; then\n\
|
| 35 |
+
# # 将令牌安全地存储到Git凭证文件中[citation:1]\n\
|
| 36 |
+
# echo \"https://${GH_USERNAME}:${GH_TOKEN}@github.com\" > ~/.git-credentials\n\
|
| 37 |
+
# echo \"GitHub令牌凭证已设置。\"\n\
|
| 38 |
+
# fi\n\
|
| 39 |
# 1. 启动 frpc (后台运行)\n\
|
| 40 |
+
# /usr/local/bin/frpc -f ${FRP_TOKEN} &\n\
|
| 41 |
# 2. 前台启动 code-server (保持容器运行)\n\
|
| 42 |
+
git remote set-url origin https://${GH_TOKEN}@github.com/${GH_USERNAME}/cpp_competition.git \n\
|
| 43 |
exec code-server /home/coder/cpp_competition' > /home/coder/start.sh
|
| 44 |
RUN chmod +x /home/coder/start.sh
|
| 45 |
|
|
|
|
| 68 |
code-server --install-extension llvm-vs-code-extensions.vscode-clangd
|
| 69 |
|
| 70 |
RUN /home/coder/create_languagepacks.sh
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
|
| 72 |
# 暴露端口
|
| 73 |
EXPOSE 8080
|