From e5df34906146bbccc5e11c60ee78308418f43131 Mon Sep 17 00:00:00 2001 From: meandmytram Date: Fri, 15 Sep 2023 17:21:30 -0400 Subject: [PATCH] add devcontainer --- .devcontainer/Dockerfile | 45 +++++++++++++++++++++++++++++++++ .devcontainer/devcontainer.json | 28 ++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 00000000..a56d8150 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,45 @@ +FROM mcr.microsoft.com/devcontainers/base:jammy +# FROM mcr.microsoft.com/devcontainers/base:jammy + +ARG DEBIAN_FRONTEND=noninteractive +ARG USER=vscode + +RUN DEBIAN_FRONTEND=noninteractive \ + && apt-get update \ + && apt-get install -y build-essential --no-install-recommends make \ + ca-certificates \ + git \ + libssl-dev \ + zlib1g-dev \ + libbz2-dev \ + libreadline-dev \ + libsqlite3-dev \ + wget \ + curl \ + llvm \ + libncurses5-dev \ + xz-utils \ + tk-dev \ + libxml2-dev \ + libxmlsec1-dev \ + libffi-dev \ + liblzma-dev + +# Python and poetry installation +USER $USER +ARG HOME="/home/$USER" +ARG PYTHON_VERSION=3.11 +# ARG PYTHON_VERSION=3.10 + +ENV PYENV_ROOT="${HOME}/.pyenv" +ENV PATH="${PYENV_ROOT}/shims:${PYENV_ROOT}/bin:${HOME}/.local/bin:$PATH" + +RUN echo "done 0" \ + && curl https://pyenv.run | bash \ + && echo "done 1" \ + && pyenv install ${PYTHON_VERSION} \ + && echo "done 2" \ + && pyenv global ${PYTHON_VERSION} \ + && echo "done 3" \ + && curl -sSL https://install.python-poetry.org | python3 - \ + && poetry config virtualenvs.in-project true \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..5473dda7 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,28 @@ +{ + "name": "poetry3-poetry-pyenv-mdopt", + "build": { + "dockerfile": "Dockerfile" + }, + + // 👇 Features to add to the Dev Container. More info: https://containers.dev/implementors/features. + // "features": {}, + + // 👇 Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // 👇 Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "poetry install --with dev,test", + + // 👇 Configure tool-specific properties. + "customizations": { + "vscode": { + "extensions":["ms-python.python", "njpwerner.autodocstring"] + } + }, + "features": { + "ghcr.io/devcontainers-contrib/features/poetry:2": {} + } + + // 👇 Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +}