refactor: devcontainer.json (#14169)

* chore: cleanup devcontainer.json

* chore: 配置devcontainer环境

* build: 更新conda配置

* chore: 更新pnpm包的安装允许列表

---------

Co-authored-by: Lucien Shaw <myxlc55@outlook.com>
This commit is contained in:
Rbqwow
2025-09-23 00:53:41 +08:00
committed by GitHub
parent aa6f1b171f
commit df32d9b4c5
6 changed files with 102 additions and 6 deletions

29
.devcontainer/Dockerfile Normal file
View File

@@ -0,0 +1,29 @@
FROM mcr.microsoft.com/devcontainers/base:ubuntu
USER vscode
ENV CONDA_DIR=/home/vscode/miniconda
ENV PATH="$CONDA_DIR/bin:$PATH"
ARG PYTHON_VERSION=3.12
ARG NODEJS_VERSION=24
# Install Miniconda
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh \
&& bash ~/miniconda.sh -b -p $CONDA_DIR \
&& rm ~/miniconda.sh \
&& conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main \
&& conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r
# Configure conda environment
RUN eval "$(conda shell.bash hook)" \
&& conda create -n maa python=$PYTHON_VERSION -y \
&& conda activate maa \
&& conda install -y conda-forge::nodejs=$NODEJS_VERSION \
&& pip install pre-commit black \
&& npm install -g pnpm
# Finalize conda setup
RUN conda init \
&& conda config --set auto_activate false \
&& echo "conda activate maa" >> ~/.bashrc

View File

@@ -1,12 +1,50 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/javascript-node
{
"image": "mcr.microsoft.com/devcontainers/cpp:ubuntu-22.04",
"features": {
"ghcr.io/devcontainers/features/python:1": {},
"ghcr.io/devcontainers/features/sshd:1": {}
"name": "MAA",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
// "image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"build": {
"dockerfile": "Dockerfile"
},
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [3001],
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "bash .devcontainer/post-create.sh",
// Configure tool-specific properties.
"customizations": {
"vscode": {
"extensions": ["llvm-vs-code-extensions.vscode-clangd", "DavidAnson.vscode-markdownlint"]
"extensions": [
"mkxml.vscode-filesize",
"nekosu.maa-support",
"DavidAnson.vscode-markdownlint",
"esbenp.prettier-vscode",
"vue.volar",
"ms-python.python",
"ms-python.black-formatter"
],
"settings": {
// format
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[markdown]": {
"editor.defaultFormatter": "DavidAnson.vscode-markdownlint"
},
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
},
// python
"python.terminal.launchArgs": ["-u"],
"python.defaultInterpreterPath": "/home/vscode/miniconda/envs/maa/bin/python",
"python.terminal.activateEnvironment": false
}
}
}
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}

View File

@@ -0,0 +1,21 @@
#!/bin/bash
WORKSPACE=$(pwd)
# conda activate maa
echo "===================="
echo "Setting up git safe.directory for $WORKSPACE and its submodules..."
cd "$WORKSPACE"
git config --global --add safe.directory "$WORKSPACE"
git submodule foreach --recursive 'git config --global --add safe.directory "$toplevel/$path"'
echo "===================="
cd "$WORKSPACE"
echo "Installing dependencies for python..."
# pip install -r tools/.../requirements.txt
# pip install -r tools/.../requirements-dev.txt
echo "===================="
echo "Installing dependencies for nodejs..."
cd "$WORKSPACE"/docs
pnpm install --frozen-lockfile

5
.gitignore vendored
View File

@@ -474,4 +474,7 @@ Thumbs.db
# build & install
build
install
install
# pnpm cache
.pnpm-store

View File

@@ -12,6 +12,7 @@ export default defineUserConfig({
lang: 'zh-CN',
title: 'MaaAssistantArknights',
description: 'MAA',
host: '0.0.0.0',
port: 3001,
locales: {

View File

@@ -1,3 +1,7 @@
packages:
- .
onlyBuiltDependencies:
- "@parcel/watcher"
- esbuild
- vue-demi