-
Notifications
You must be signed in to change notification settings - Fork 300
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(build): improve devcontainers setup with poetry (#506)
1. Replaces uses an image directly. 2. Creates a custom image, still based off the original Image. 3. Installs poetry inside the container. This saves the user about 20 seconds every container load. 4. Installs `pre-commit` in the container. Saves more time. 5. Enables `pre-commit`. From inside the container the user cannot commit without `pre-commit` running. 6. Adds in git autocomplete to the container (see screenshot) 7. Adds in poetry autocomplete to the container (see screenshot) ![devcontainer-completion](https://github.com/testcontainers/testcontainers-python/assets/1908139/11446f78-4fbf-4d08-a997-043ae1632919) --------- Co-authored-by: bstrausser <[email protected]> Co-authored-by: David Ankin <[email protected]> Co-authored-by: Bálint Bartha <[email protected]>
- Loading branch information
1 parent
95100a3
commit 99c13b7
Showing
3 changed files
with
28 additions
and
3 deletions.
There are no files selected for viewing
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
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 |
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
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 |
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