Skip to content

Commit

Permalink
added devcontainer to brick-template
Browse files Browse the repository at this point in the history
  • Loading branch information
tomlue committed Jun 26, 2024
1 parent 93af676 commit de1c4d7
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
FROM mcr.microsoft.com/devcontainers/python:3.9

# Install necessary packages
RUN apt-get update && apt-get install -y \
wget \
unzip \
xvfb \
libxi6 \
libgconf-2-4 \
libnss3-dev \
libxss1 \
libappindicator1 \
fonts-liberation \
libatk-bridge2.0-0 \
libgtk-3-0 \
libgbm1 \
libasound2 \
libdpkg-perl \
libatomic1 \
ca-certificates \
curl \
gnupg \
python3-venv \
awscli

# Install pipx and biobricks
RUN python3 -m pip install --user pipx \
&& python3 -m pipx ensurepath

# Create /mnt/biobricks directory and set permissions
RUN mkdir -p /mnt/biobricks/biobricks-ai \
&& chown -R vscode:vscode /mnt/biobricks

# Add pipx binaries to the PATH for all users
RUN echo 'export PATH="$PATH:$HOME/.local/bin"' >> /etc/bash.bashrc \
&& echo 'export PATH="$PATH:$HOME/.local/bin"' >> /home/vscode/.bashrc

# Switch to vscode user to perform user-specific installations
USER vscode

# Install Python dependencies
COPY requirements.txt /tmp/requirements.txt
RUN pip install -r /tmp/requirements.txt

# Accept build argument for BIOBRICKS_TOKEN
ARG BIOBRICKS_TOKEN
ENV BIOBRICKS_TOKEN=${BIOBRICKS_TOKEN}

# Install biobricks and configure it
RUN /bin/bash -c 'source /etc/bash.bashrc && pipx install biobricks && biobricks version' \
&& /bin/bash -c 'if [ -z "$BIOBRICKS_TOKEN" ] || [ ${#BIOBRICKS_TOKEN} -lt 5 ]; then echo "BIOBRICKS_TOKEN is not set or is too short (less than 5 characters)"; exit 1; fi' \
&& /bin/bash -c 'source /etc/bash.bashrc && biobricks configure --bblib=/mnt/biobricks --token=${BIOBRICKS_TOKEN} --interactive=False'

# Switch back to root user to complete setup
USER root
25 changes: 25 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "SMRT Development Container",
"build": {
"dockerfile": "Dockerfile",
"context": "..",
"args": {
"BIOBRICKS_TOKEN": "${localEnv:BIOBRICKS_TOKEN}"
}
},
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:1": {}
},
"settings": {
"terminal.integrated.defaultProfile.linux": "bash",
"python.pythonPath": "/usr/local/bin/python"
},
"extensions": [
"ms-python.python",
"ms-toolsai.jupyter",
"ms-vsliveshare.vsliveshare", // Live Share extension
"github.copilot", // GitHub Copilot extension
"insilica.vscode-pycmd"
],
"remoteUser": "vscode"
}

0 comments on commit de1c4d7

Please sign in to comment.