Update dev container (#2157)
* Update dev contaienr configuration Signed-off-by: Simon Zhao <simonyansenzhao@gmail.com> * Use conda to manage environments Signed-off-by: Simon Zhao <simonyansenzhao@gmail.com> * Set Python interpreter Signed-off-by: Simon Zhao <simonyansenzhao@gmail.com> * Update Signed-off-by: Simon Zhao <simonyansenzhao@gmail.com> * Add machine specs Signed-off-by: Simon Zhao <simonyansenzhao@gmail.com> --------- Signed-off-by: Simon Zhao <simonyansenzhao@gmail.com>
This commit is contained in:
Родитель
4f5861d81d
Коммит
d0a4af3ae6
|
@ -1,28 +0,0 @@
|
|||
ARG PYTHON_VERSION
|
||||
FROM mcr.microsoft.com/vscode/devcontainers/python:${PYTHON_VERSION}
|
||||
|
||||
ARG REMOTE_USER
|
||||
ENV HOME="/home/${REMOTE_USER}" \
|
||||
JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64" \
|
||||
PYSPARK_PYTHON="/usr/local/bin/python" \
|
||||
PYSPARK_DRIVER_PYTHON="/usr/local/bin/python"
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get -y install --no-install-recommends software-properties-common && \
|
||||
apt-add-repository 'deb http://security.debian.org/debian-security stretch/updates main' && \
|
||||
apt-get update && \
|
||||
apt-get -y install --no-install-recommends \
|
||||
openjdk-8-jre \
|
||||
cmake
|
||||
|
||||
# Switch to non-root user
|
||||
USER ${REMOTE_USER}
|
||||
WORKDIR ${HOME}
|
||||
|
||||
# Setup Jupyter Notebook
|
||||
ENV NOTEBOOK_CONFIG="${HOME}/.jupyter/jupyter_notebook_config.py"
|
||||
RUN mkdir -p $(dirname ${NOTEBOOK_CONFIG}) && \
|
||||
echo "c.NotebookApp.ip='0.0.0.0'" >> ${NOTEBOOK_CONFIG} && \
|
||||
echo "c.NotebookApp.open_browser=False" >> ${NOTEBOOK_CONFIG} && \
|
||||
echo "c.NotebookApp.allow_origin='*'" >> ${NOTEBOOK_CONFIG}
|
||||
EXPOSE 8888
|
|
@ -1,44 +1,50 @@
|
|||
{
|
||||
"name": "Recommenders",
|
||||
"build": {
|
||||
"dockerfile": "Dockerfile",
|
||||
"context": "..",
|
||||
"args": {
|
||||
// Python version: 3, 3.6, 3.7
|
||||
"PYTHON_VERSION": "3.7",
|
||||
"REMOTE_USER": "vscode"
|
||||
}
|
||||
},
|
||||
"name": "Recommenders",
|
||||
// Version list: https://github.com/devcontainers/images/tree/main/src/base-ubuntu
|
||||
// Includes: curl, wget, ca-certificates, git, Oh My Zsh!,
|
||||
"image": "mcr.microsoft.com/devcontainers/base:ubuntu-24.04",
|
||||
"hostRequirements": {
|
||||
"cpus": 4,
|
||||
"memory": "16gb",
|
||||
"storage": "32gb"
|
||||
},
|
||||
"features": {
|
||||
// https://github.com/devcontainers/features/blob/main/src/anaconda/devcontainer-feature.json
|
||||
"ghcr.io/devcontainers/features/anaconda:1": {
|
||||
"version": "2024.06-1"
|
||||
}
|
||||
},
|
||||
"customizations": {
|
||||
"vscode": {
|
||||
// Set *default* container specific settings.json values on container create.
|
||||
"settings": {
|
||||
"[python]": {
|
||||
"editor.defaultFormatter": "ms-python.black-formatter",
|
||||
"editor.formatOnSave": true,
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.organizeImports": "explicit"
|
||||
}
|
||||
},
|
||||
"isort.args": ["--profile", "black"],
|
||||
"python.analysis.autoImportCompletions": true,
|
||||
"python.defaultInterpreterPath": "/usr/local/conda/envs/Recommenders/bin/python",
|
||||
"python.testing.pytestEnabled": true,
|
||||
// set the directory where all tests are
|
||||
"python.testing.pytestArgs": ["tests"]
|
||||
},
|
||||
// Add the IDs of extensions you want installed when the container is created.
|
||||
"extensions": [
|
||||
"ms-python.black-formatter", // https://marketplace.visualstudio.com/items?itemName=ms-python.black-formatter
|
||||
"ms-python.isort", // https://marketplace.visualstudio.com/items?itemName=ms-python.isort
|
||||
"ms-python.mypy-type-checker", // https://marketplace.visualstudio.com/items?itemName=ms-python.mypy-type-checker
|
||||
"ms-python.pylint", // https://marketplace.visualstudio.com/items?itemName=ms-python.pylint
|
||||
"ms-python.python", // https://marketplace.visualstudio.com/items?itemName=ms-python.python
|
||||
"ms-toolsai.datawrangler", // https://marketplace.visualstudio.com/items?itemName=ms-toolsai.datawrangler
|
||||
"ms-toolsai.jupyter" // https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
// Set *default* container specific settings.json values on container create.
|
||||
"settings": {
|
||||
"python.pythonPath": "/usr/local/bin/python",
|
||||
"python.languageServer": "Pylance",
|
||||
"python.linting.enabled": true,
|
||||
"python.linting.pylintEnabled": true,
|
||||
"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
|
||||
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
|
||||
"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
|
||||
"python.linting.banditPath": "/usr/local/py-utils/bin/bandit",
|
||||
"python.linting.flake8Path": "/usr/local/py-utils/bin/flake8",
|
||||
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
|
||||
"python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
|
||||
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
|
||||
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint"
|
||||
},
|
||||
|
||||
// Add the IDs of extensions you want installed when the container is created.
|
||||
"extensions": [
|
||||
"ms-python.python",
|
||||
"ms-python.vscode-pylance"
|
||||
],
|
||||
|
||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||
"forwardPorts": [8888],
|
||||
|
||||
// Use 'postCreateCommand' to run commands after the container is created.
|
||||
"postCreateCommand": "pip install -U pip && pip install --user -e .[dev,examples,spark,xlearn]",
|
||||
|
||||
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
|
||||
"remoteUser": "vscode"
|
||||
// Use 'postCreateCommand' to run commands after the container is created.
|
||||
"postCreateCommand": "conda create -n Recommenders -c conda-forge -y python=3.10 openjdk=21 pip && conda init bash && bash -c -i 'conda activate Recommenders && pip install -e .[dev,spark]' && conda config --set auto_activate_base false"
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче