Skip to content

Commit

Permalink
improve devcontainer to remove image build
Browse files Browse the repository at this point in the history
  • Loading branch information
ITProKyle committed Sep 18, 2024
1 parent 53c13cf commit 4396aa6
Show file tree
Hide file tree
Showing 12 changed files with 175 additions and 101 deletions.
12 changes: 0 additions & 12 deletions .devcontainer/.editorconfig

This file was deleted.

52 changes: 0 additions & 52 deletions .devcontainer/Dockerfile

This file was deleted.

86 changes: 76 additions & 10 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,86 @@
{
"build": {
"args": {
"VARIANT": "ubuntu-22.04"
},
"dockerfile": "Dockerfile"
"containerEnv": {
"AWS_DEFAULT_REGION": "${localEnv:AWS_DEFAULT_REGION:us-east-1}",
"AWS_MAX_ATTEMPTS": "20",
"AWS_RETRY_MODE": "adaptive",
"CFNGIN_STACK_POLL_TIME": "3",
"TZ": "${localEnv:TZ:US/Eastern}"
},
"customizations": {
"vscode": {
"extensions": [
"ms-python.python"
]
"Compulim.vscode-clock",
"DavidAnson.vscode-markdownlint",
"PeterSchmalfeldt.explorer-exclude",
"SirTori.indenticator",
"Tyriar.sort-lines",
"VisualStudioExptTeam.vscodeintellicode",
"bierner.markdown-checkbox",
"charliermarsh.ruff",
"christian-kohler.path-intellisense",
"donjayamanne.githistory",
"eamodio.gitlens",
"editorconfig.editorconfig",
"github.vscode-github-actions",
"hashicorp.terraform",
"lextudio.restructuredtext",
"mohsen1.prettify-json",
"ms-python.black-formatter",
"ms-python.python",
"ms-python.vscode-pylance",
"oderwat.indent-rainbow",
"redhat.vscode-yaml",
"remcohaszing.schemastore",
"richie5um2.vscode-sort-json",
"streetsidesoftware.code-spell-checker",
"tamasfe.even-better-toml",
"trond-snekvik.simple-rst",
"yzhang.markdown-all-in-one"
],
"settings": {
"terminal.integrated.defaultProfile.linux": "zsh",
"terminal.integrated.profiles.linux": {
"bash": {
"icon": "terminal-bash",
"path": "bash"
},
"zsh": {
"path": "zsh"
}
}
}
}
},
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
"./local-features/poetry": {},
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
"ghcr.io/devcontainers/features/node:1": {}
},
"name": "Ubuntu",
"remoteUser": "vscode"
"image": "mcr.microsoft.com/devcontainers/python:3.12",
"mounts": [
{
"source": "${localEnv:HOME}/.aws",
"target": "/home/vscode/.aws",
"type": "bind"
},
{
"source": "devcontainer-${containerWorkspaceFolderBasename}-node_modules",
"target": "${containerWorkspaceFolder}/node_modules",
"type": "volume"
},
{
"source": "devcontainer-npm-cache",
"target": "/home/vscode/.npm",
"type": "volume"
},
{
"source": "devcontainer-${containerWorkspaceFolderBasename}-pre-commit-cache",
"target": "/home/vscode/.cache/pre-commit",
"type": "volume"
}
],
"name": "devcontainer-runway",
"onCreateCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}; sudo apt-get update -y; sudo apt-get install direnv",
"postAttachCommand": "make setup",
"postStartCommand": "sudo chown -R vscode:vscode .venv node_modules ~/.cache/pre-commit ~/.npm ~/.cache/pip ~/.cache/pypoetry"
}
3 changes: 0 additions & 3 deletions .devcontainer/files/.bash_completion

This file was deleted.

3 changes: 3 additions & 0 deletions .devcontainer/local-features/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# local-feature

A collection of local devcontainer features.
11 changes: 11 additions & 0 deletions .devcontainer/local-features/poetry/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# poetry

Install `poetry` using `pipx` included on the image.

## Example Usage

```json
"features": {
"./local-features/poetry": {}
}
```
26 changes: 26 additions & 0 deletions .devcontainer/local-features/poetry/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"description": "Install `poetry` using `pipx` included in the image.",
"documentationURL": "",
"id": "poetry",
"installsAfter": [],
"mounts": [
{
"source": "devcontainer-pip-cache",
"target": "/home/vscode/.cache/pip",
"type": "volume"
},
{
"source": "devcontainer-poetry-cache",
"target": "/home/vscode/.cache/pypoetry",
"type": "volume"
},
{
"source": "devcontainer-${containerWorkspaceFolderBasename}-venv",
"target": "${containerWorkspaceFolder}/.venv",
"type": "volume"
}
],
"name": "poetry",
"options": {},
"version": "0.0.0"
}
20 changes: 20 additions & 0 deletions .devcontainer/local-features/poetry/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#! /usr/bin/env bash

set -eo pipefail

function __install_poetry {
if [[ -z "$(command -v poetry)" ]]; then
pipx install poetry;
pipx inject poetry "poetry-dynamic-versioning[plugin]" poetry-plugin-export;
fi
}

function __configure_poetry {
poetry config virtualenvs.create true;
poetry config virtualenvs.in-project true;
poetry config virtualenvs.prefer-active-python true;
poetry config warnings.export false;
}

__install_poetry;
__configure_poetry;
24 changes: 13 additions & 11 deletions .vscode/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"**/.cache",
"**/.envrc",
"**/.git",
".devcontainer/files/.bash_completion",
"**/.devcontainer/devcontainer.json",
"**/.gitignore",
"**/.runway/**",
"**/.secret",
Expand Down Expand Up @@ -72,20 +72,11 @@
"maxNumberOfProblems": 100,
"version": "0.2",
"words": [
"ALGS",
"EOCD",
"FQDNs",
"Fakhreddine",
"Inconsolata",
"Ngin",
"PYXMLSEC",
"Pipefile",
"SPHINXAUTOBUILD",
"SPHINXAUTOBUILDPORT",
"absolutepath",
"abstractmethod",
"accesspoint",
"addoption",
"ALGS",
"appendleft",
"arcname",
"argparsing",
Expand Down Expand Up @@ -116,6 +107,7 @@
"copydir",
"datetimez",
"devel",
"direnv",
"dockerized",
"domparator",
"downstreams",
Expand All @@ -124,16 +116,19 @@
"edgelambda",
"ekscluster",
"eksservicerole",
"EOCD",
"errmsg",
"excinfo",
"execglobals",
"Fakhreddine",
"filedes",
"filedir",
"filehandle",
"fileinfo",
"fileinfos",
"fileout",
"foobarfoo",
"FQDNs",
"frontmatter",
"fstring",
"furo",
Expand All @@ -148,6 +143,7 @@
"humanreadable",
"identless",
"igittigitt",
"Inconsolata",
"indentless",
"instancerole",
"intersphinx",
Expand Down Expand Up @@ -175,6 +171,7 @@
"nestedval",
"newdir",
"newfile",
"Ngin",
"nitpicky",
"nodegroup",
"nodeinstanceprofile",
Expand All @@ -190,10 +187,13 @@
"outputquery",
"paravirtual",
"partitionkey",
"Pipefile",
"prehook",
"prepad",
"prevdir",
"pypoetry",
"pyupgrade",
"PYXMLSEC",
"readacl",
"refreshable",
"rglob",
Expand All @@ -209,6 +209,8 @@
"shouldraise",
"sourcebucket",
"sourcekey",
"SPHINXAUTOBUILD",
"SPHINXAUTOBUILDPORT",
"ssmstore",
"ssword",
"subclasscheck",
Expand Down
8 changes: 7 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
{
"recommendations": [
"DavidAnson.vscode-markdownlint",
"charliermarsh.ruff",
"editorconfig.editorconfig",
"lextudio.restructuredtext",
"ms-python.black-formatter",
"ms-python.python",
"ms-python.vscode-pylance"
"ms-python.vscode-pylance",
"redhat.vscode-yaml",
"streetsidesoftware.code-spell-checker",
"tamasfe.even-better-toml"
]
}
3 changes: 3 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,9 @@
# https://sphinxcontribexternal-links.readthedocs.io/latest/configuration.html
external_links: dict[str, str] = {
"CloudFormation": "https://aws.amazon.com/cloudformation",
"devcontainer": "https://containers.dev/",
"direnv": "https://github.com/direnv/direnv",
"poetry-dynamic-versioning": "https://github.com/mtkennerly/poetry-dynamic-versioning",
"troposphere": "https://github.com/cloudtools/troposphere",
}
external_links_substitutions: dict[str, str] = {
Expand Down
Loading

0 comments on commit 4396aa6

Please sign in to comment.