From bc843e792f683e3d56baa81f1f85bba2299b0f9e Mon Sep 17 00:00:00 2001 From: Jinyuan Huang <88757735+BernieHuang2008@users.noreply.github.com> Date: Sat, 16 Dec 2023 05:01:51 +0000 Subject: [PATCH 1/4] devcontainer --- .devcontainer/Dockerfile | 4 ++++ .devcontainer/devcontainer.json | 23 +++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..9e58719 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,4 @@ +FROM mcr.microsoft.com/devcontainers/base:debian + +RUN apt-get update && \ + apt-get -y install python3 python3-venv redis firefox-esr graphviz imagemagick librsvg2-bin fonts-dejavu shellcheck diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..8efea08 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,23 @@ +{ + "build": { + "dockerfile": "Dockerfile" + }, + "features": { + "ghcr.io/devcontainers/features/github-cli": {} + }, + "customizations": { + "vscode": { + "extensions": [ + "ms-python.python", + "ms-azuretools.vscode-docker" + ], + "remote.otherPortsAttributes": { + "protocol": "https" + }, + "settings": { + "files.autoSave": "off" + } + } + }, + "postCreateCommand": "git pull" +} \ No newline at end of file From 347dab896a5e3ca1b76d30a7a6c42d5e10a0e905 Mon Sep 17 00:00:00 2001 From: Jinyuan Huang <88757735+BernieHuang2008@users.noreply.github.com> Date: Sun, 17 Dec 2023 11:33:22 +0800 Subject: [PATCH 2/4] Update Dockerfile: Mysql service --- .devcontainer/Dockerfile | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 9e58719..60fb484 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,14 @@ -FROM mcr.microsoft.com/devcontainers/base:debian +# 使用官方的 Ubuntu 基础镜像 +FROM ubuntu:latest -RUN apt-get update && \ - apt-get -y install python3 python3-venv redis firefox-esr graphviz imagemagick librsvg2-bin fonts-dejavu shellcheck +# 安装必要的工具 +RUN apt-get update && apt-get install -y \ + mysql-server \ + && rm -rf /var/lib/apt/lists/* + +# 配置 MySQL(root密码:root) +RUN service mysql start && \ + mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root'; FLUSH PRIVILEGES;" + +# 暴露 MySQL 端口 +EXPOSE 3306 From e4643f6a7afbc2238cfd91b3f432c1aeb62558cb Mon Sep 17 00:00:00 2001 From: Jinyuan Huang <88757735+BernieHuang2008@users.noreply.github.com> Date: Sun, 17 Dec 2023 11:35:33 +0800 Subject: [PATCH 3/4] Update devcontainer.json --- .devcontainer/devcontainer.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 8efea08..1748d81 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -19,5 +19,7 @@ } } }, - "postCreateCommand": "git pull" + "forwardPorts": [3306], + "postCreateCommand": "git pull & service mysql start", + "remoteUser": "root" } \ No newline at end of file From 4e3e0336ca5cd53032460917ea3a801b265dde59 Mon Sep 17 00:00:00 2001 From: Jinyuan Huang <88757735+BernieHuang2008@users.noreply.github.com> Date: Sun, 17 Dec 2023 11:56:32 +0800 Subject: [PATCH 4/4] Update devcontainer.json --- .devcontainer/devcontainer.json | 1 - 1 file changed, 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 1748d81..03f5e87 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -21,5 +21,4 @@ }, "forwardPorts": [3306], "postCreateCommand": "git pull & service mysql start", - "remoteUser": "root" } \ No newline at end of file