FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

chore(build): improve devcontainers setup with poetry by bearrito · Pull Request #506 · testcontainers/testcontainers-python · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .json  (1) .sh  (1) No extension  (1) All 3 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
20 changes: 20 additions & 0 deletions .devcontainer/Dockerfile
This file contains hidden or 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM mcr.microsoft.com/devcontainers/python:1-3.11-bookworm


RUN \
apt update && apt install bash-completion -y && \
pip install pre-commit && \
curl -sSL https://install.python-poetry.org | POETRY_HOME=/home/vscode/.local python3 -


RUN \
echo >> /home/vscode/.bashrc && \
# add completions to bashrc
# see how ubuntu does it for reference:
# https://git.launchpad.net/ubuntu/+source/base-files/tree/share/dot.bashrc
# https://stackoverflow.com/a/68566555
echo 'if [ -f /etc/bash_completion ] && ! shopt -oq posix; then' >> /home/vscode/.bashrc && \
echo ' . /etc/bash_completion' >> /home/vscode/.bashrc && \
echo 'fi' >> /home/vscode/.bashrc && \
echo >> /home/vscode/.bashrc && \
echo '. <(poetry completions)' >> /home/vscode/.bashrc
3 changes: 1 addition & 2 deletions .devcontainer/commands/post-create-command.sh
This file contains hidden or 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
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
echo "Running post-create-command.sh"

curl -sSL https://install.python-poetry.org | python3 -

pre-commit install
poetry install --all-extras
8 changes: 7 additions & 1 deletion .devcontainer/devcontainer.json
This file contains hidden or 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
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
{
"name": "Python 3",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/python:1-3.11-bookworm",
"build": {
// Path is relative to the devcontainer.json file.
// We prebuild the image to get poetry into the image
// This saves the user a bit of time, when re-opening containers
"dockerfile": "Dockerfile"
},

"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {
"version": "latest",
Expand Down

Back | FazBrowse Home | New Git URL