Skip to content

Commit 6df776a

Browse files
committed
sync dynamic files
1 parent 34cb45d commit 6df776a

10 files changed

Lines changed: 342 additions & 59 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
FROM texlive/texlive:latest
2+
RUN if id "ubuntu" &>/dev/null; then \
3+
echo "Deleting user 'ubuntu'" && userdel -f -r ubuntu || echo "Failed to delete ubuntu user."; \
4+
else \
5+
echo "User 'ubuntu' does not exist."; \
6+
fi
7+
28
COPY .devcontainer/container-docs/environment /usr/local/share/environments/
39
COPY install.py /usr/local/share/app_installation/install.py
410
COPY .github/.repodynamics/metadata.json /usr/local/share/app_installation/metadata.json

.devcontainer/container-docs/devcontainer.json

Lines changed: 126 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,88 @@
11
{
2-
"containerUser": "dev",
2+
"containerUser": "pypackit-dev",
33
"customizations": {
44
"vscode": {
55
"extensions": [
66
"James-Yu.latex-workshop",
7-
"ExecutableBookProject.myst-highlight"
7+
"ExecutableBookProject.myst-highlight",
8+
"ms-python.python",
9+
"ms-python.vscode-pylance",
10+
"ms-python.debugpy",
11+
"ms-toolsai.jupyter",
12+
"ms-toolsai.jupyter-keymap",
13+
"ms-toolsai.jupyter-renderers",
14+
"ms-vscode.cpptools",
15+
"ritwickdey.LiveServer",
16+
"VisualStudioExptTeam.vscodeintellicode",
17+
"ms-toolsai.vscode-jupyter-cell-tags",
18+
"ms-toolsai.vscode-jupyter-slideshow",
19+
"twxs.cmake",
20+
"ms-vscode.cmake-tools",
21+
"redhat.java",
22+
"ms-azuretools.vscode-docker",
23+
"dbaeumer.vscode-eslint",
24+
"eamodio.gitlens",
25+
"ms-vscode.cpptools-extension-pack",
26+
"VisualStudioExptTeam.intellicode-api-usage-examples",
27+
"formulahendry.code-runner",
28+
"GitHub.copilot",
29+
"GitHub.copilot-chat",
30+
"GitHub.vscode-pull-request-github",
31+
"ms-vscode-remote.remote-ssh-edit",
32+
"ecmel.vscode-html-css",
33+
"formulahendry.auto-rename-tag",
34+
"redhat.vscode-yaml",
35+
"MS-vsliveshare.vsliveshare",
36+
"xabikos.JavaScriptSnippets",
37+
"ms-vscode.remote-explorer",
38+
"christian-kohler.path-intellisense",
39+
"golang.Go",
40+
"formulahendry.auto-close-tag",
41+
"bmewburn.vscode-intelephense-client",
42+
"streetsidesoftware.code-spell-checker",
43+
"donjayamanne.githistory",
44+
"KevinRose.vsc-python-indent",
45+
"njpwerner.autodocstring",
46+
"wholroyd.jinja",
47+
"jeff-hykin.better-cpp-syntax",
48+
"mechatroner.rainbow-csv",
49+
"techer.open-in-browser",
50+
"mhutchie.git-graph",
51+
"yzhang.markdown-all-in-one",
52+
"Zignd.html-css-class-completion",
53+
"DavidAnson.vscode-markdownlint",
54+
"aaron-bond.better-comments",
55+
"naumovs.color-highlight",
56+
"redhat.vscode-xml",
57+
"tomoki1207.pdf",
58+
"pranaygp.vscode-css-peek",
59+
"shd101wyy.markdown-preview-enhanced",
60+
"ms-vscode.makefile-tools",
61+
"GitHub.codespaces",
62+
"rust-lang.rust-analyzer",
63+
"GitHub.remotehub",
64+
"ms-vscode.remote-repositories",
65+
"GitHub.vscode-github-actions",
66+
"thekalinga.bootstrap4-vscode",
67+
"ziyasal.vscode-open-in-github",
68+
"ZainChen.json",
69+
"kisstkondoros.vscode-gutter-preview",
70+
"tamasfe.even-better-toml",
71+
"shardulm94.trailing-spaces",
72+
"quicktype.quicktype",
73+
"yzane.markdown-pdf",
74+
"bierner.markdown-mermaid",
75+
"GraphQL.vscode-graphql",
76+
"ms-python.pylint",
77+
"bierner.github-markdown-preview",
78+
"jock.svg",
79+
"charliermarsh.ruff",
80+
"ms-python.mypy-type-checker",
81+
"graphql.vscode-graphql-syntax"
882
],
983
"settings": {
10-
"terminal.integrated.scrollback": 100000
84+
"python.defaultInterpreterPath": "/opt/conda/envs/website/bin/python",
85+
"terminal.integrated.scrollback": 1000000
1186
}
1287
}
1388
},
@@ -19,24 +94,62 @@
1994
"../features/pkg_setup": {
2095
"packages": "{\n \\\"website\\\": {\n \\\"packages\\\": [\n {\n \\\"id\\\": \\\"ci\\\",\n \\\"extras\\\": \\\"all\\\"\n }\n ],\n \\\"python-version\\\": \\\"3.13\\\",\n \\\"sources\\\": \\\"pip conda apt bash\\\"\n }\n}"
2196
},
22-
"ghcr.io/devcontainers/features/common-utils:2": {},
97+
"../features/setup-user": {},
98+
"ghcr.io/devcontainers-extra/features/apt-get-packages:1": {
99+
"packages": ""
100+
},
101+
"ghcr.io/devcontainers/features/common-utils:2": {
102+
"configureZshAsDefaultShell": true,
103+
"installOhMyZsh": true,
104+
"installOhMyZshConfig": true,
105+
"installZsh": true,
106+
"upgradePackages": true,
107+
"userGid": "1000",
108+
"userUid": "1000",
109+
"username": "pypackit-dev"
110+
},
23111
"ghcr.io/devcontainers/features/conda:1": {
24112
"addCondaForge": true,
25113
"version": "latest"
26114
},
27-
"ghcr.io/devcontainers/features/git:1": {}
115+
"ghcr.io/devcontainers/features/git-lfs:1": {
116+
"autoPull": true,
117+
"version": "latest"
118+
},
119+
"ghcr.io/devcontainers/features/git:1": {
120+
"ppa": false,
121+
"version": "latest"
122+
},
123+
"ghcr.io/devcontainers/features/github-cli:1": {
124+
"version": "latest"
125+
},
126+
"ghcr.io/devcontainers/features/node:1": {
127+
"installYarnUsingApt": true,
128+
"nodeGypDependencies": true,
129+
"nvmInstallPath": "/usr/local/share/nvm",
130+
"nvmVersion": "latest",
131+
"pnpmVersion": "latest",
132+
"version": "latest"
133+
}
28134
},
29135
"name": "Documentation Environment",
136+
"overrideFeatureInstallOrder": [
137+
"ghcr.io/devcontainers/features/common-utils",
138+
"ghcr.io/devcontainers/features/git",
139+
"ghcr.io/devcontainers/features/node",
140+
"ghcr.io/devcontainers/features/conda",
141+
"ghcr.io/devcontainers/features/git-lfs",
142+
"ghcr.io/devcontainers/features/github-cli",
143+
"./features/setup-user",
144+
"ghcr.io/devcontainers-extra/features/apt-get-packages",
145+
"./features/conda_setup",
146+
"./features/pkg_setup"
147+
],
30148
"postCreateCommand": {
31-
"install_devcontainers_cli": [
32-
"npm",
33-
"install",
34-
"-g",
35-
"@devcontainers/cli"
36-
],
37-
"source_tasks": "echo 'source /workspace/.devcontainer/container-docs/tasks_local.sh' | tee -a ~/.bashrc ~/.bash_profile"
149+
"activate_conda_env": "echo 'conda activate website' | tee -a ~/.bashrc ~/.bash_profile ~/.zshrc ~/.zprofile",
150+
"source_tasks": "echo 'source /workspace/.devcontainer/container-docs/tasks_local.sh' | tee -a ~/.bashrc ~/.bash_profile ~/.zshrc ~/.zprofile"
38151
},
39-
"remoteUser": "dev",
152+
"remoteUser": "pypackit-dev",
40153
"service": "docs",
41154
"shutdownAction": "none",
42155
"workspaceFolder": "/workspace"

.devcontainer/devcontainer.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"containerUser": "codespace",
2+
"containerUser": "pypackit-dev",
33
"customizations": {
44
"vscode": {
55
"extensions": [
@@ -163,7 +163,7 @@
163163
"upgradePackages": true,
164164
"userGid": "1000",
165165
"userUid": "1000",
166-
"username": "codespace"
166+
"username": "pypackit-dev"
167167
},
168168
"ghcr.io/devcontainers/features/conda:1": {
169169
"addCondaForge": true,
@@ -253,6 +253,7 @@
253253
}
254254
},
255255
"postCreateCommand": {
256+
"activate_conda_env": "echo 'conda activate app' | tee -a ~/.bashrc ~/.bash_profile ~/.zshrc ~/.zprofile",
256257
"install_devcontainers_cli": [
257258
"npm",
258259
"install",
@@ -272,12 +273,12 @@
272273
"--config",
273274
".config/pre-commit.yaml"
274275
],
275-
"source_tasks": "echo 'source /workspace/.devcontainer/tasks_local.sh' | tee -a ~/.bashrc ~/.bash_profile"
276+
"source_tasks": "echo 'source /workspace/.devcontainer/tasks_local.sh' | tee -a ~/.bashrc ~/.bash_profile ~/.zshrc ~/.zprofile"
276277
},
277278
"remoteEnv": {
278279
"LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}"
279280
},
280-
"remoteUser": "codespace",
281+
"remoteUser": "pypackit-dev",
281282
"service": "main",
282283
"shutdownAction": "none",
283284
"workspaceFolder": "/workspace"

.devcontainer/features/conda_setup/devcontainer-feature.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
"description": "Absolute path to the directory containing conda environment files.",
1313
"type": "string"
1414
},
15-
"log_dir": {
16-
"default": "/var/log/conda_setup",
15+
"log_dirpath": {
16+
"default": "/var/log/devcontainer-build/conda_setup",
1717
"description": "Absolute path to a directory to write log files.",
1818
"type": "string"
1919
}
2020
},
21-
"postCreateCommand": "echo \"Initializing conda...\" && conda init; echo \"Removing existing Conda channels...\" && config --remove-key channels 2>/dev/null || true; echo \"Adding conda-forge as the only channel...\" && conda config --add channels conda-forge && echo \"Setting strict channel priority...\" && conda config --set channel_priority strict; echo \"Verifying channels...\" && conda config --show channels;",
21+
"postCreateCommand": "echo \"Initializing conda...\" && conda init --all; echo \"Removing existing Conda channels...\" && config --remove-key channels 2>/dev/null || true; echo \"Adding conda-forge as the only channel...\" && conda config --add channels conda-forge && echo \"Setting strict channel priority...\" && conda config --set channel_priority strict; echo \"Verifying channels...\" && conda config --show channels;",
2222
"version": "0.1.0"
2323
}
Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,36 @@
11
#!/usr/bin/env bash
2-
set -eux
2+
set -euxo pipefail
3+
4+
# Redirect stdout and stderr to a file
5+
echo "Creating log directory..."
6+
mkdir -p "$LOG_DIRPATH"
7+
LOG_FILE="${LOG_DIRPATH}/install.log"
8+
exec > >(tee -a "$LOG_FILE") 2>&1
9+
310
echo "Initializing conda..."
411
conda init
12+
513
echo "Removing existing Conda channels..."
614
conda config --remove-key channels 2>/dev/null || true
15+
716
echo "Adding conda-forge as the only channel..."
817
conda config --add channels conda-forge
18+
919
echo "Setting strict channel priority..."
1020
conda config --set channel_priority strict
21+
1122
echo "Verifying channels..."
1223
conda config --show channels
24+
1325
echo "Updating conda..."
1426
conda update -n base --all -y
15-
echo "Creating log directory..."
16-
mkdir -p $LOG_DIR
27+
1728
if [ -d $ENV_DIR ] && find $ENV_DIR -name '*.yaml' | grep -q .; then
1829
umask 0002;
1930
for file in $ENV_DIR/*.yaml; do
20-
conda env update --file "$file" 2>&1 | tee "$LOG_DIR/$(basename "$file").log";
31+
conda env update --file "$file" 2>&1 | tee "$LOG_DIRPATH/env_$(basename "$file").log";
2132
done;
2233
fi
34+
2335
echo "Cleaning up cache..."
2436
conda clean --all -y

.devcontainer/features/pkg_setup/devcontainer-feature.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
],
88
"name": "Package Setup",
99
"options": {
10-
"log_dir": {
11-
"default": "/var/log/conda_setup",
10+
"log_dirpath": {
11+
"default": "/var/log/devcontainer-build/pkg_setup",
1212
"description": "Absolute path to a directory to write log files.",
1313
"type": "string"
1414
},

.devcontainer/features/pkg_setup/install.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#!/usr/bin/env bash
22
set -euxo pipefail
33

4-
echo "Creating log directory..."
5-
mkdir -p "$LOG_DIR"
6-
LOG_FILE="${LOG_DIR}/install.log"
74
# Redirect stdout and stderr to a file
5+
echo "Creating log directory..."
6+
mkdir -p "$LOG_DIRPATH"
7+
LOG_FILE="${LOG_DIRPATH}/install.log"
88
exec > >(tee -a "$LOG_FILE") 2>&1
99

1010
# Create postStartCommand script

.devcontainer/features/setup-user/devcontainer-feature.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,12 @@
2222
},
2323
"id": "setup-user",
2424
"name": "Setup user configs",
25+
"options": {
26+
"log_dirpath": {
27+
"default": "/var/log/devcontainer-build/user_setup",
28+
"description": "Absolute path to a directory to write log files.",
29+
"type": "string"
30+
}
31+
},
2532
"version": "0.1.0"
2633
}

.devcontainer/features/setup-user/install.sh

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,25 @@ link_if_exists() {
2222
fi
2323
}
2424

25+
get_debian_flavor() {
26+
local codename=""
27+
28+
if [ -f /etc/os-release ]; then
29+
. /etc/os-release
30+
codename="${VERSION_CODENAME:-}"
31+
fi
32+
33+
# Fallback to lsb_release if codename is still empty
34+
if [ -z "$codename" ] && command -v lsb_release >/dev/null 2>&1; then
35+
codename="$(lsb_release -c -s)"
36+
fi
37+
38+
# Final fallback
39+
codename="${codename:-unknown}"
40+
41+
echo "$codename"
42+
}
43+
2544
# Redirect stdout and stderr to a file
2645
echo "Creating log directory..."
2746
mkdir -p "$LOG_DIRPATH"
@@ -56,19 +75,21 @@ elif [ "${USERNAME}" = "none" ] || ! id -u ${USERNAME} > /dev/null 2>&1; then
5675
USERNAME=root
5776
fi
5877

78+
# Set common variables.
79+
HOME_DIR="/home/${USERNAME}"
80+
OPT_DIR="/opt"
81+
DEBIAN_FLAVOR="$(get_debian_flavor)"
82+
5983
# Enable the oryx tool to generate manifest-dir which is needed for running the postcreate tool.
6084
# Oryx expects the tool to be installed at `/opt/oryx` and looks for relevant files in there.
6185
ORYX_DIR="/opt/oryx"
62-
DEBIAN_FLAVOR="focal-scm"
6386
mkdir -p "$ORYX_DIR"
6487
echo "vso-focal" > "$ORYX_DIR/.imagetype"
65-
echo "DEBIAN|${DEBIAN_FLAVOR}" | tr '[a-z]' '[A-Z]' > "$ORYX_DIR/.ostype"
88+
echo "DEBIAN|${DEBIAN_FLAVOR}-SCM" | tr '[a-z]' '[A-Z]' > "$ORYX_DIR/.ostype"
6689
if compgen -G "/usr/local/oryx/*" > /dev/null; then
6790
ln -snf /usr/local/oryx/* "$ORYX_DIR"
6891
fi
6992

70-
HOME_DIR="/home/${USERNAME}"
71-
OPT_DIR="/opt"
7293
# Tool links
7394
DOTNET_PATH="${HOME_DIR}/.dotnet"
7495
HUGO_PATH="${HOME_DIR}/.hugo/current"

0 commit comments

Comments
 (0)