Skip to content

Commit e40fcf1

Browse files
committed
Add devcontainer config
1 parent 8be4927 commit e40fcf1

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed

.devcontainer/Dockerfile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
FROM geerlingguy/docker-debian12-ansible:latest
2+
3+
ENV LANG=C.UTF-8
4+
ENV LC_ALL=C.UTF-8
5+
6+
RUN apt-get update && \
7+
apt-get install -y --no-install-recommends \
8+
python3-passlib \
9+
git \
10+
pwgen \
11+
openssh-client \
12+
curl && \
13+
rm -rf /var/lib/apt/lists/* && \
14+
rm -Rf /usr/share/doc && rm -Rf /usr/share/man && \
15+
apt-get clean
16+
17+
# Install Just
18+
RUN curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to /usr/local/bin
19+
20+
# Preserve command history across container restarts
21+
RUN SNIPPET="export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhistory/.bash_history" \
22+
&& echo "$SNIPPET" >> "/root/.bashrc"

.devcontainer/devcontainer.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// For format details, see https://aka.ms/devcontainer.json.
2+
{
3+
"name": "matrix-docker-ansible-deploy",
4+
"build": {
5+
"dockerfile": "Dockerfile",
6+
"context": ".."
7+
},
8+
"postCreateCommand": {
9+
"Fix Volume Permissions": "sudo chown -R $(whoami): /commandhistory"
10+
},
11+
"postAttachCommand": "bash",
12+
"mounts": [
13+
{
14+
"source": "${localEnv:SSH_AUTH_SOCK}",
15+
"target": "/agent.sock",
16+
"type": "bind"
17+
},
18+
{
19+
"source": "matrix-docker-ansible-deploy-bashhistory",
20+
"target": "/commandhistory",
21+
"type": "volume"
22+
}
23+
],
24+
"containerEnv": {
25+
"SSH_AUTH_SOCK": "/agent.sock"
26+
},
27+
"customizations": {
28+
"vscode": {
29+
"extensions": [
30+
"EditorConfig.EditorConfig",
31+
"redhat.ansible",
32+
"redhat.vscode-yaml",
33+
"ms-python.python"
34+
]
35+
}
36+
}
37+
}

0 commit comments

Comments
 (0)