-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from datamol-io/devcontainer
Add Devcontainer configuration
- Loading branch information
Showing
3 changed files
with
165 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
source /usr/lib/git-core/git-sh-prompt | ||
|
||
# Bash prompt | ||
GIT_PS1_SHOWUNTRACKEDFILES=1 | ||
GIT_PS1_SHOWDIRTYSTATE=1 | ||
if [ $(whoami) = root ]; then | ||
SYMBOL="#" | ||
else | ||
SYMBOL="$" | ||
fi | ||
PS1='\[\033[01;32m\]\u\[\033[0m\] \[\033[1;34m\]\h \[\033[1;35m\]\W\[\033[1;31m\]$(__git_ps1 " (%s)") \[\033[0m\]$SYMBOL ' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
FROM ghcr.io/mamba-org/micromamba:jammy | ||
|
||
# Take root for the system-wide setup | ||
USER root | ||
|
||
# Install system-wide packages with `apt` | ||
RUN export DEBIAN_FRONTEND=noninteractive && apt update --fix-missing && \ | ||
apt install --no-install-recommends -y \ | ||
ca-certificates \ | ||
moreutils \ | ||
bash-completion \ | ||
less \ | ||
watch \ | ||
git \ | ||
patch \ | ||
git-lfs \ | ||
nano \ | ||
jq \ | ||
gnupg2 \ | ||
openssh-client \ | ||
file \ | ||
htop \ | ||
zip \ | ||
unzip \ | ||
p7zip-full \ | ||
curl \ | ||
wget \ | ||
lsof \ | ||
iputils-ping \ | ||
iproute2 \ | ||
net-tools \ | ||
dnsutils \ | ||
socat \ | ||
telnet \ | ||
&& apt clean && rm -rf /var/lib/apt/lists/* | ||
|
||
# Install bash completions | ||
RUN mkdir -p /etc/bash_completion.d \ | ||
&& sh -c "curl -L https://raw.githubusercontent.com/docker/compose/1.29.2/contrib/completion/bash/docker-compose > /etc/bash_completion.d/docker-compose" \ | ||
&& sh -c "curl -L https://raw.githubusercontent.com/docker/cli/v20.10.13/contrib/completion/bash/docker > /etc/bash_completion.d/docker" \ | ||
&& sh -c "curl -L https://raw.githubusercontent.com/git/git/v2.35.1/contrib/completion/git-completion.bash > /etc/bash_completion.d/git" | ||
|
||
# Make sure everyone can access the workspaces directory. | ||
ENV WORKSPACES_DIR="/workspaces" | ||
RUN : \ | ||
&& mkdir --parents --mode=777 "${WORKSPACES_DIR}" \ | ||
&& chown "$MAMBA_USER:$MAMBA_USER" "${WORKSPACES_DIR}" | ||
|
||
# Sane defaults for Git | ||
RUN : \ | ||
# Switch default editor from vim to nano | ||
&& git config --system core.editor nano \ | ||
# Prevent unintentional merges | ||
# <https://blog.sffc.xyz/post/185195398930/why-you-should-use-git-pull-ff-only-git-is-a> | ||
&& git config --system pull.ff only \ | ||
# Use default branch name "main" instead of "master" | ||
&& git config --system init.defaultBranch main \ | ||
# Initialize Git LFS | ||
&& git lfs install --system --skip-repo \ | ||
; | ||
|
||
# Go back to regular user | ||
USER $MAMBA_USER | ||
|
||
# Install git prompt | ||
# NOTE(hadim): likely a bit hacky | ||
COPY --chown=$MAMBA_USER:$MAMBA_USER .devcontainer/bashrc /tmp/bashrc | ||
RUN cat /tmp/bashrc >> ~/.bashrc | ||
|
||
# Install the Conda packages | ||
ARG CONDA_ENV_FILE | ||
COPY --chown=$MAMBA_USER:$MAMBA_USER ${CONDA_ENV_FILE} /tmp/${CONDA_ENV_FILE} | ||
RUN micromamba install --yes --name base --file /tmp/${CONDA_ENV_FILE} \ | ||
&& micromamba clean --all --yes | ||
|
||
# Activate the conda environment for the Dockerfile. | ||
# <https://github.com/mamba-org/micromamba-docker#running-commands-in-dockerfile-within-the-conda-environment> | ||
ARG MAMBA_DOCKERFILE_ACTIVATE=1 | ||
|
||
# Create and set the workspace folder | ||
ARG CONTAINER_WORKSPACE_FOLDER=/workspaces/default-workspace-folder | ||
RUN mkdir -p "${CONTAINER_WORKSPACE_FOLDER}" | ||
WORKDIR "${CONTAINER_WORKSPACE_FOLDER}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
{ | ||
"name": "medchem", | ||
"containerEnv": { | ||
"TZ": "America/Montreal", | ||
"LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}", | ||
"CONTAINER_WORKSPACE_FOLDER": "${containerWorkspaceFolder}" | ||
}, | ||
"remoteUser": "mambauser", | ||
"runArgs": [ | ||
"--hostname", | ||
"devcontainer" | ||
// // Warning: loading .env into the environment will undermine the ability | ||
// // to use .env to dynamically adjust the unspecified values. | ||
// "--env-file", ".env" | ||
], | ||
"build": { | ||
"dockerfile": "dev.Dockerfile", | ||
"context": "../", | ||
"args": { | ||
"CONTAINER_WORKSPACE_FOLDER": "${containerWorkspaceFolder}", | ||
"CONDA_ENV_FILE": "env.yml" | ||
} | ||
}, | ||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
"forwardPorts": [], | ||
// allow the entrypoint to run | ||
// "overrideCommand": false, | ||
// Use 'postCreateCommand' to run commands after the container is created. | ||
"postCreateCommand": "pip install -e .", | ||
// Customize the way VS Code is started when running in the container | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"ms-python.python", | ||
"ms-python.vscode-pylance", | ||
"ms-toolsai.jupyter", | ||
"ms-azuretools.vscode-docker", | ||
"ms-vsliveshare.vsliveshare", | ||
"donjayamanne.githistory", | ||
"mutantdino.resourcemonitor", | ||
"github.copilot", | ||
"davidanson.vscode-markdownlint" | ||
], | ||
"settings": { | ||
// Disable telemetry | ||
"telemetry.enableTelemetry": false, | ||
// For linting (code format checking), disable pylint and enable | ||
// pydocstyle for docstrings and flake8 for code. | ||
"python.linting.pylintEnabled": false, | ||
"python.linting.pydocstyleEnabled": false, | ||
"python.linting.flake8Enabled": false, | ||
// Turn on "black" for automatic code formatting | ||
"python.formatting.provider": "black", | ||
// Disable barely usable scrollbar | ||
"workbench.editor.wrapTabs": true, | ||
// Use Pylance | ||
"python.languageServer": "Pylance", | ||
"python.analysis.typeCheckingMode": "basic", | ||
// Path of the default Python environment | ||
"python.pythonPath": "/opt/conda/bin/python", | ||
"python.defaultInterpreterPath": "/opt/conda/bin/python", | ||
// Disable the "conda activate base" command when opening a new terminal | ||
"python.terminal.activateEnvironment": false, | ||
// Make sure that key combos like Ctrl+K are not intercepted by VS Code | ||
// when using the terminal | ||
"terminal.integrated.allowChords": false, | ||
"terminal.integrated.inheritEnv": false | ||
} | ||
} | ||
} | ||
} |