Created
September 15, 2023 03:01
-
-
Save akkuman/f92f3c35dd37de2967ba678e594d384c to your computer and use it in GitHub Desktop.
python开发容器样例(带 poetry)
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
Show hidden characters
{ | |
"name": "myproject", | |
"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": "", | |
// 👇 Configure tool-specific properties. | |
"customizations": { | |
"vscode": { | |
"extensions": [ | |
"ms-python.python", | |
"njpwerner.autodocstring" | |
] | |
} | |
} | |
// 👇 Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. | |
// "remoteUser": "root" | |
} |
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
FROM mcr.microsoft.com/devcontainers/python:1-3.8-bullseye | |
ARG DEBIAN_FRONTEND=noninteractive | |
ARG USER=vscode | |
RUN sed -i "s|http://deb.debian.org/debian|http://mirror.sjtu.edu.cn/debian|g" /etc/apt/sources.list | |
USER $USER | |
ARG HOME="/home/$USER" | |
ENV PATH="${HOME}/.local/bin:$PATH" | |
RUN pip config set global.index-url https://mirror.sjtu.edu.cn/pypi/web/simple && \ | |
curl -sSL https://install.python-poetry.org | python3 - && \ | |
rm -rf ~/.config/pip/pip.conf && \ | |
poetry config virtualenvs.in-project true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment