Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
24 changes: 24 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -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",
}