Skip to content

Instantly share code, notes, and snippets.

@akkuman
Created September 15, 2023 03:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akkuman/f92f3c35dd37de2967ba678e594d384c to your computer and use it in GitHub Desktop.
Save akkuman/f92f3c35dd37de2967ba678e594d384c to your computer and use it in GitHub Desktop.
python开发容器样例(带 poetry)
{
"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"
}
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