Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .devcontainer/vscode-init/02-download-extensions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ set -e
# of the extension and its functionality gets inherited by devcontainers.

EXTENSIONS_FILE="extensions-to-download.txt"
DOWNLOAD_DIR="/opt/vscode-extensions"
DOWNLOAD_DIR=${1:-"/opt/vscode-extensions"}
SUCCESSFUL_DOWNLOADS=()

mkdir -p "${DOWNLOAD_DIR}"
Expand Down
3 changes: 0 additions & 3 deletions .devcontainer/vscode-init/extensions-to-install.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
# These extensions will be enabled for all users of the devcontainer.
# One extension ID per line.
charliermarsh.ruff
Continue.continue --pre-release
DavidAnson.vscode-markdownlint
eamodio.gitlens
# The marimo extension has been removed from the marketplace whilst it is being rewritten.
marimo-team.vscode-marimo
mechatroner.rainbow-csv
ms-ossdata.vscode-pgsql --pre-release
Expand All @@ -15,5 +13,4 @@ ms-toolsai.jupyter
#openai.chatgpt
qwenlm.qwen-code-vscode-ide-companion
REditorSupport.r
REditorSupport.r-syntax
yzhang.markdown-all-in-one
35 changes: 15 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,21 @@ ARG VSCODE_COMMIT=bf9252a2fb45be6893dd8870c0bf37e2e1766d61

ENV VSCODE_COMMIT=${VSCODE_COMMIT}

# Copy and run VS Code installation files
COPY .devcontainer/vscode-init /opt/vscode-init

# Copy Qwen settings
COPY .devcontainer/qwen-settings.json /root/.qwen/settings.json

# Copy Codex config
COPY .devcontainer/codex-config.toml /root/.codex/config.toml

# Copy Continue Dev config
COPY .devcontainer/continue-config.yaml /root/.continue/config.yaml
COPY .devcontainer/continue.env /root/.continue/.env

# Copy scripts folder to /opt/scripts (accessible at runtime)
COPY scripts /opt/scripts

RUN cd /opt/vscode-init \
&& ./00-install-vscode-server.sh ${VSCODE_COMMIT} \
&& ./01-install-extensions.sh ${VSCODE_COMMIT} \
&& ./02-download-extensions.sh
# Copy custom scripts and installation files
COPY .devcontainer /opt/.devcontainer

# Copy devcontainerctl folder to /opt/devcontainerctl (accessible at runtime)
COPY devcontainerctl /opt/devcontainerctl

# Run VS Code installation files & copy configurations
RUN cd /opt/.devcontainer/vscode-init \
&& /opt/.devcontainer/vscode-init/00-install-vscode-server.sh ${VSCODE_COMMIT} \
&& /opt/.devcontainer/vscode-init/01-install-extensions.sh ${VSCODE_COMMIT} \
&& /opt/.devcontainer/vscode-init/02-download-extensions.sh /opt/vscode-extensions \
&& mkdir -p /root/.qwen && cp /opt/.devcontainer/qwen-settings.json /root/.qwen/settings.json \
&& mkdir -p /root/.codex && cp /opt/.devcontainer/codex-config.toml /root/.codex/config.toml \
&& mkdir -p /root/.continue && cp /opt/.devcontainer/continue-config.yaml /root/.continue/config.yaml \
&& cp /opt/.devcontainer/continue.env /root/.continue/.env

WORKDIR /workspace

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ ces-pull a a ghcr.io/smartdatafoundry/devcontainer:latest
# 2. Extract the setup scripts
podman run --rm -v $HOME:$HOME -w $HOME \
ghcr.io/smartdatafoundry/devcontainer:latest \
cp -r /opt/scripts $HOME/devcontainer-scripts
cp -r /opt/devcontainerctl $HOME/devcontainerctl

# 3. Run the setup script (one-time setup)
cd $HOME/devcontainer-scripts
cd $HOME/devcontainerctl
./setup.sh

# 4. Start your devcontainer
Expand Down Expand Up @@ -106,7 +106,7 @@ For detailed manual setup instructions, see the **[SDF TRE Setup Guide](docs/SDF
|-------|-----------|
| SDF TRE usage | [`docs/SDF_TRE_SETUP.md`](docs/SDF_TRE_SETUP.md) |
| Full container internals | [`docs/DEVCONTAINER.md`](docs/DEVCONTAINER.md) |
| Setup scripts | [`scripts/`](scripts/) directory |
| Setup scripts | [`devcontainerctl/`](devcontainerctl/) directory |
| Reusable publish workflow | [`docs/BUILD_PUBLISH_CONTAINER.md`](docs/BUILD_PUBLISH_CONTAINER.md) |
| Dev Container Specification | https://containers.dev |

Expand All @@ -119,7 +119,7 @@ For detailed manual setup instructions, see the **[SDF TRE Setup Guide](docs/SDF
- **Shell**: Zsh with Oh My Zsh (via common-utils feature)
- **Quarto**: Document publishing platform (latest version)
- **Marimo**: Markdown presentation tool, alternative to Jupyter Notebooks
- **User Setup Scripts**: Automated deployment and management tools ([`scripts/`](scripts/))
- **User Setup Scripts**: Automated deployment and management tools ([`devcontainerctl/`](devcontainerctl/))
- **VS Code Extensions (curated)**:
- Continue (AI assistant)
- Black (Python formatting)
Expand Down
File renamed without changes.
27 changes: 20 additions & 7 deletions scripts/setup.sh → devcontainerctl/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,31 @@ NC='\033[0m' # No Color
echo -e "${GREEN}DevContainer Setup Script${NC}"
echo "================================"

# Define paths
# Define files & paths
SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
SCRIPT_SOURCE="$SCRIPT_DIR/devcontainerctl"
SYMLINK_TARGET="$HOME/bin/devcontainerctl"
CRON_COMMAND="0 8 * * * $SYMLINK_TARGET sync"
EXTENSION_FILE="/safe_data/shared/vscode-extensions/ms-vscode-remote.remote-containers.vsix"

# Check if source script exists
if [ ! -f "$SCRIPT_SOURCE" ]; then
echo -e "${RED}Error: Source script not found at $SCRIPT_SOURCE${NC}"
exit 1
fi

# Install VS Code remote containers extensions if code command is available
if command -v code >/dev/null 2>&1; then
echo -e "${YELLOW}Installing VS Code remote containers extension...${NC}"
code --install-extension $EXTENSION_FILE || {
echo -e "${RED}Failed to install remote containers extension${NC}"
exit 1
}
else
echo -e "${RED}VS Code command 'code' not found. Skipping extension installation.${NC}"
exit 1
fi

# Create ~/bin directory if it doesn't exist
if [ ! -d "$HOME/bin" ]; then
echo -e "${YELLOW}Creating $HOME/bin directory...${NC}"
Expand All @@ -32,7 +45,7 @@ fi
# Create symlink
if [ -L "$SYMLINK_TARGET" ]; then
echo -e "${YELLOW}Symlink already exists at $SYMLINK_TARGET${NC}"
echo "Removing old symlink..."
echo -e "${YELLOW}Removing old symlink...${NC}"
rm "$SYMLINK_TARGET"
fi

Expand All @@ -42,7 +55,7 @@ ln -s "$SCRIPT_SOURCE" "$SYMLINK_TARGET"
# Make sure the source script is executable
if [ ! -x "$SCRIPT_SOURCE" ]; then
echo -e "${YELLOW}Warning: $SCRIPT_SOURCE is not executable${NC}"
echo "You may need to run: sudo chmod +x $SCRIPT_SOURCE"
echo -e "${YELLOW}You may need to run: sudo chmod +x $SCRIPT_SOURCE${NC}"
fi

# Add ~/bin to PATH if not already present
Expand Down Expand Up @@ -75,9 +88,9 @@ echo ""
echo "================================"
echo -e "${GREEN}Setup Complete!${NC}"
echo ""
echo "Verification:"
echo " Symlink: $(ls -la $SYMLINK_TARGET 2>/dev/null || echo 'Not found')"
echo " Cron job:"
crontab -l | grep "devcontainerctl sync" || echo " Not found"
echo -e "${GREEN}Verification:${NC}"
echo -e "${GREEN} Symlink: $(ls -la $SYMLINK_TARGET 2>/dev/null || echo 'Not found')${NC}"
echo -e "${GREEN} Cron job:${NC}"
crontab -l | grep "devcontainerctl sync" || echo -e "${GREEN} Not found${NC}"
echo ""
echo -e "${YELLOW}Note: You may need to restart your shell or run 'source ~/.bashrc'${NC}"
15 changes: 8 additions & 7 deletions docs/DEVCONTAINER.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ This dev container includes:
* **Marimo**: Alternative interactive notebook/presentation tool
* **VS Code Server**: Pre-installed (pin via tag families)
* **VS Code Extensions**: Curated list (see [`.devcontainer/vscode-init/extensions-to-install.txt`](.devcontainer/vscode-init/extensions-to-install.txt))
* **User Setup Scripts**: Automated deployment and management tools (at `/opt/scripts/` in container)
* **User Setup Scripts**: Automated deployment and management tools (at `/opt/devcontainerctl/` in container)

### User Setup Scripts

The container includes scripts in [`/opt/scripts/`](../scripts/) to simplify deployment and management:
The container includes scripts in [`/opt/devcontainerctl/`](../devcontainerctl/) to simplify deployment and management:

#### [`scripts/devcontainerctl`](scripts/devcontainerctl)
#### [`devcontainerctl/devcontainerctl`](../devcontainerctl/devcontainerctl)
A comprehensive container lifecycle management script that provides:

**Features:**
Expand Down Expand Up @@ -112,24 +112,25 @@ devcontainerctl stop # Stop container
devcontainerctl remove # Remove container
```

#### [`scripts/setup.sh`](scripts/setup.sh)
#### [`devcontainerctl/setup.sh`](../devcontainerctl/setup.sh)
One-time setup script that configures your environment:

**What it does:**
- Creates `~/bin` directory if needed
- Creates symlink to `devcontainerctl` in `~/bin`
- Adds `~/bin` to PATH in `~/.bashrc`
- Configures daily cron job (8:00 AM) to sync images using `devcontainerctl sync`
- Installs VS Code remote extensions for devcontainer enablement

**Usage:**
```bash
# Extract scripts from container first
podman run --rm -v $HOME:$HOME -w $HOME \
ghcr.io/smartdatafoundry/devcontainer:latest \
cp -r /opt/scripts $HOME/devcontainer-scripts
cp -r /opt/devcontainerctl $HOME/devcontainerctl

# Run setup
cd $HOME/devcontainer-scripts
cd $HOME/devcontainerctl
./setup.sh
```

Expand Down Expand Up @@ -186,7 +187,7 @@ This keeps maintenance simple: update the default by editing a single line in [`
│ ├── build-devcontainer.yml # Dev container build workflow
│ ├── build-publish-container.yml # Container publishing workflow
│ └── update-vscode.yml # VS Code version update workflow
├── scripts/ # User deployment scripts
├── devcontainerctl/ # User deployment scripts
│ ├── devcontainerctl # Container management script
│ └── setup.sh # One-time setup script
├── assets/ # Documentation assets
Expand Down
6 changes: 3 additions & 3 deletions docs/SDF_TRE_SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ ces-pull a a ghcr.io/smartdatafoundry/devcontainer:latest
# 2. Extract the setup scripts
podman run --rm -v $HOME:$HOME -w $HOME \
ghcr.io/smartdatafoundry/devcontainer:latest \
cp -r /opt/scripts $HOME/devcontainer-scripts
cp -r /opt/devcontainerctl $HOME/devcontainerctl

# 3. Run the one-time setup
cd $HOME/devcontainer-scripts
cd $HOME/devcontainerctl
./setup.sh

# 4. Start your devcontainer
Expand Down Expand Up @@ -53,7 +53,7 @@ The devcontainer includes scripts that automate deployment and management in the
After extracting the scripts (see Quick Start above), run the setup script:

```bash
cd $HOME/devcontainer-scripts
cd $HOME/devcontainerctl
./setup.sh
```

Expand Down
Loading