Skip to content
This repository has been archived by the owner on Nov 30, 2023. It is now read-only.

Commit

Permalink
Update python 3 image: install requirements.txt if exists
Browse files Browse the repository at this point in the history
  • Loading branch information
qubitron committed Apr 16, 2019
1 parent ac5b865 commit 29d325b
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 7 deletions.
12 changes: 9 additions & 3 deletions containers/python-3/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,23 @@
FROM python:3

# Copy default endpoint specific user settings overrides into container to specify Python path
COPY settings.vscode.json /root/.vscode-remote/data/Machine/settings.json

RUN pip install pylint
COPY .devcontainer/settings.vscode.json /root/.vscode-remote/data/Machine/settings.json

# Install git, process tools
RUN apt-get update && apt-get -y install git procps

# Install any missing dependencies for enhanced language service
RUN apt-get install -y libicu[0-9][0-9]

# Install Python dependencies from requirements.txt if it exists
COPY .devcontainer/requirements.txt.temp requirements.txt* /workspace/
RUN if [ -f "requirements.txt" ]; then pip install -r requirements.txt && rm requirements.txt; fi

# Expose port 5000 as the default web port
EXPOSE 5000

# Clean up
RUN apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*

8 changes: 5 additions & 3 deletions containers/python-3/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"name": "Python 3",
"dockerFile": "Dockerfile",
"dockerComposeFile": "docker-compose.yml",
"service": "app",
"workspaceFolder": "/workspace",
"extensions": [
"ms-python.python",
"LittleFoxTeam.vscode-python-test-adapter"
"VisualStudioExptTeam.vscodeintellicode"
]
}
}
12 changes: 12 additions & 0 deletions containers/python-3/.devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: '3'

services:
app:
build:
context: ..
dockerfile: .devcontainer/Dockerfile
ports:
- 5000:5000
volumes:
- ..:/workspace
command: sleep infinity
Empty file.
2 changes: 1 addition & 1 deletion containers/python-3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Summary

*A basic dev container definition for developing Python 3 applications in a container. Includes everything you need to get up and running like PyLint and the Python extension.*
*A basic dev container definition for developing Python 3 applications in a container. Installs dependencies from your requirements.txt file and the Python extension.*

| Metadata | Value |
|----------|-------|
Expand Down

0 comments on commit 29d325b

Please sign in to comment.