diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..60fb484 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,14 @@ +# 使用官方的 Ubuntu 基础镜像 +FROM ubuntu:latest + +# 安装必要的工具 +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 diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..03f5e87 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,24 @@ +{ + "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" + } + } + }, + "forwardPorts": [3306], + "postCreateCommand": "git pull & service mysql start", +} \ No newline at end of file