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 3613ebc
Show file tree
Hide file tree
Showing 3 changed files with 91 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 .devcontainer/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_PUBLIC_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
29 changes: 29 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "SMRT Development Container",
"build": {
"dockerfile": "Dockerfile",
"context": "..",
"args": {
"BIOBRICKS_TOKEN": "${localEnv:BIOBRICKS_TOKEN}"
}
},
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:1": {}
},
"customizations": {
"vscode": {
"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"
}
7 changes: 7 additions & 0 deletions .devcontainer/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
python-dotenv==1.0.1
pandas==2.2.2
biobricks==0.3.7
fastparquet==2024.5.0
pyarrow==16.1.0
dvc==3.51.1
dvc-s3==3.2.0

0 comments on commit 3613ebc

Please sign in to comment.