Skip to content

Commit a72369a

Browse files
authored
Merge pull request #1 from dleeftink/alpine-micromamba
Alpine Micromamba devcontainer
2 parents 8be33df + 94bd852 commit a72369a

5 files changed

Lines changed: 93 additions & 5 deletions

File tree

.devcontainer/env.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Base dependencies
2+
3+
name: base
4+
channels:
5+
- conda-forge
6+
dependencies:
7+
- python=3.12.2

.devcontainer/setup.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
3+
echo 'Please wait for setup to finish ...'
4+
eval "$(micromamba shell hook --shell bash)"
5+
6+
# get repo
7+
8+
if [ $(find . -maxdepth 1 -type d ! -name . ! -name .devcontainer | wc -l) -eq 0 ];
9+
then
10+
11+
mv .devcontainer ..
12+
git clone "$target_repo" .
13+
# rm -rf .devcontainer
14+
# git clean -f -f
15+
# mv ../.devcontainer .
16+
mv -f ../.devcontainer/devcontainer.json .devcontainer
17+
18+
else
19+
20+
echo Contents available :
21+
22+
fi
23+
24+
micromamba activate
25+
micromamba install -y -n base -f .devcontainer/env.yaml &&
26+
micromamba clean --all --yes
27+
28+
# project dependencies installed via package.json
29+
# and postinstall script
30+
31+
npm install

.devcontainer/welcome-message.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

.github/devImage.jsonc

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"name": "Observable Framework Python starter",
3+
"image": "mambaorg/micromamba:alpine3.19",
4+
"features": {
5+
"ghcr.io/cirolosapio/devcontainers-features/alpine-node:0": {
6+
"globalPackages": "@devcontainers/cli" // remove in prod
7+
},
8+
"ghcr.io/cirolosapio/devcontainers-features/alpine-docker-outside-of-docker:0": {}, // remove in prod
9+
"ghcr.io/devcontainers-contrib/features/bash-command:1": {
10+
"command": "apk update && apk add coreutils && apk add git"
11+
}
12+
13+
},
14+
15+
// "remoteUser": "root", // run as root when in prod
16+
17+
"remoteEnv": {
18+
"target_repo": "https://github.com/dleeftink/observable-python-codespace.git",
19+
"$MAMBA_ROOT_PREFIX": "/opt/conda"
20+
},
21+
22+
"forwardPorts": [3000],
23+
"portsAttributes": {
24+
"3000": {
25+
"label": "Live preview",
26+
"onAutoForward": "openPreview"
27+
}
28+
},
29+
30+
"onCreateCommand": "echo 'Please wait for live pane ...'",
31+
// "waitFor": "updateContentCommand",
32+
33+
"postCreateCommand": "source .devcontainer/setup.sh",
34+
35+
"postAttachCommand": {
36+
"serve": "npm run dep && npm run dev"
37+
},
38+
39+
"customizations": {
40+
"vscode": {
41+
"extensions": ["ms-azuretools.vscode-docker"]/*,
42+
43+
"settings": {
44+
"terminal.integrated.defaultProfile.linux": "bash",
45+
"terminal.integrated.profiles.linux": {
46+
"bash": {
47+
"path": "/bin/bash"
48+
}
49+
}
50+
}*/
51+
}
52+
}
53+
}

package.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22
"dependencies": {
33
"@observablehq/framework": "^1.0.0"
44
},
5-
65
"scripts": {
7-
8-
"obs": "npm run dev --prefix penguin-classification"
9-
6+
"dep": "npm install --prefix penguin-classification && micromamba install -c conda-forge --file penguin-classification/requirements.txt -y",
7+
"dev": "npm run dev --prefix penguin-classification"
108
}
119
}

0 commit comments

Comments
 (0)