From 0f40fe62705193f8948ee6487380234cd8552e7d Mon Sep 17 00:00:00 2001 From: Jonah Aragon Date: Wed, 11 Jun 2025 13:45:55 -0600 Subject: [PATCH] Add devcontainer config --- .devcontainer/Dockerfile | 22 ++++++++++++++++++++ .devcontainer/devcontainer.json | 37 +++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 000000000..1b839defe --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,22 @@ +FROM geerlingguy/docker-debian12-ansible:latest + +ENV LANG=C.UTF-8 +ENV LC_ALL=C.UTF-8 + +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + python3-passlib \ + git \ + pwgen \ + openssh-client \ + curl && \ + rm -rf /var/lib/apt/lists/* && \ + rm -Rf /usr/share/doc && rm -Rf /usr/share/man && \ + apt-get clean + +# Install Just +RUN curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to /usr/local/bin + +# Preserve command history across container restarts +RUN SNIPPET="export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhistory/.bash_history" \ + && echo "$SNIPPET" >> "/root/.bashrc" diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..32327e434 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,37 @@ +// For format details, see https://aka.ms/devcontainer.json. +{ + "name": "matrix-docker-ansible-deploy", + "build": { + "dockerfile": "Dockerfile", + "context": ".." + }, + "postCreateCommand": { + "Fix Volume Permissions": "sudo chown -R $(whoami): /commandhistory" + }, + "postAttachCommand": "bash", + "mounts": [ + { + "source": "${localEnv:SSH_AUTH_SOCK}", + "target": "/agent.sock", + "type": "bind" + }, + { + "source": "matrix-docker-ansible-deploy-bashhistory", + "target": "/commandhistory", + "type": "volume" + } + ], + "containerEnv": { + "SSH_AUTH_SOCK": "/agent.sock" + }, + "customizations": { + "vscode": { + "extensions": [ + "EditorConfig.EditorConfig", + "redhat.ansible", + "redhat.vscode-yaml", + "ms-python.python" + ] + } + } +}