mirror of
https://github.com/fscotto/infra.git
synced 2026-11-26 13:49:52 +00:00
Replace OpenCode Desktop with Cline and add ecaas devcontainer setup
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
ARG MAVEN_VERSION=3.9.16
|
||||
FROM docker.io/library/maven:${MAVEN_VERSION}-eclipse-temurin-11 AS maven
|
||||
FROM docker.io/library/node:22.23.4-bookworm-slim AS node
|
||||
# Java 21 runs the language servers only. The final image keeps Java 11 on PATH.
|
||||
FROM mcr.microsoft.com/devcontainers/java:21-bookworm AS ide
|
||||
FROM mcr.microsoft.com/devcontainers/java:11-bookworm
|
||||
USER root
|
||||
COPY --from=ide /usr/lib/jvm/msopenjdk-current/ /opt/jdk-21/
|
||||
COPY --from=maven /usr/share/maven/ /usr/share/maven/
|
||||
COPY --from=node /usr/local/bin/node /usr/local/bin/node
|
||||
COPY --from=node /usr/local/lib/node_modules/npm/ /usr/local/lib/node_modules/npm/
|
||||
RUN ln -s /usr/share/maven/bin/mvn /usr/local/bin/mvn \
|
||||
&& ln -s ../lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm \
|
||||
&& ln -s ../lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx \
|
||||
&& java -version \
|
||||
&& /opt/jdk-21/bin/java -version \
|
||||
&& mvn -v \
|
||||
&& npm install --global --no-audit --no-fund @anthropic-ai/claude-code@2.1.312 cline@3.0.74 \
|
||||
&& npm cache clean --force
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends bash-completion ca-certificates curl fzf git git-lfs gnupg openssh-client zoxide \
|
||||
&& arch="$(dpkg --print-architecture)" \
|
||||
&& case "$arch" in \
|
||||
amd64) sha256=ea4f0222950ee750a3d38dd80d03bce4cee07a3f63928fc47548383bcaf23093 ;; \
|
||||
arm64) sha256=0edc36cf514f1bd84becac3e94ee8ae9f8818c6a1f99f7b2ee67b362afa253d3 ;; \
|
||||
*) echo "Unsupported architecture for delta: $arch" >&2; exit 1 ;; \
|
||||
esac \
|
||||
&& curl -fsSL --retry 3 "https://github.com/dandavison/delta/releases/download/0.19.2/git-delta_0.19.2_${arch}.deb" -o /tmp/git-delta.deb \
|
||||
&& echo "$sha256 /tmp/git-delta.deb" | sha256sum -c - \
|
||||
&& apt-get install -y --no-install-recommends /tmp/git-delta.deb \
|
||||
&& rm -rf /var/lib/apt/lists/* /tmp/git-delta.deb
|
||||
COPY --chown=vscode:vscode bashrc /home/vscode/.bashrc
|
||||
USER vscode
|
||||
# Keep this file writable so VS Code can register its Git credential helper.
|
||||
RUN git config --file /home/vscode/.gitconfig include.path /run/ecaas-git/gitconfig
|
||||
@@ -0,0 +1,109 @@
|
||||
---
|
||||
- name: Refuse to deploy the ecaas workspace outside WSL
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- "'wsl2' in (ansible_facts.kernel | default('') | lower)"
|
||||
- ansible_facts.distribution | default('') == 'Fedora'
|
||||
fail_msg: Run this deployment from the Fedora WSL 2 distribution on deadalus.
|
||||
|
||||
- name: Prepare the ecaas workspace and private configuration
|
||||
vars:
|
||||
ecaas_agent_state: "{{ user_home }}/.local/state/ecaas-devcontainer"
|
||||
ecaas_git_available_cas: >-
|
||||
{{ ecaas_git_ca_probe.results | selectattr('stat.isreg', 'defined') |
|
||||
selectattr('stat.isreg') | map(attribute='item') | list }}
|
||||
ecaas_agent_config:
|
||||
- src: .claude/settings.json
|
||||
dest: claude/settings.json
|
||||
- src: .claude/CLAUDE.md
|
||||
dest: claude/CLAUDE.md
|
||||
- src: .claude/rules
|
||||
dest: claude/rules
|
||||
- src: .claude/skills
|
||||
dest: claude/skills
|
||||
- src: .config/ai/bootstrap.md
|
||||
dest: ai/bootstrap.md
|
||||
- src: .cline/data/globalState.json
|
||||
dest: cline/data/globalState.json
|
||||
- src: .cline/data/settings/global-settings.json
|
||||
dest: cline/data/settings/global-settings.json
|
||||
- src: .cline/rules
|
||||
dest: cline/rules
|
||||
- src: .cline/skills
|
||||
dest: cline/skills
|
||||
block:
|
||||
- name: Prepare the ecaas Git configuration
|
||||
ansible.builtin.import_tasks: ecaas_git.yml
|
||||
|
||||
- name: Ensure the ecaas dev container directory exists
|
||||
ansible.builtin.file:
|
||||
path: "{{ workstation_ecaas_workspace }}/.devcontainer"
|
||||
state: directory
|
||||
owner: "{{ username }}"
|
||||
group: "{{ user_group }}"
|
||||
mode: "0755"
|
||||
|
||||
- name: Ensure private ecaas agent state directories exist
|
||||
ansible.builtin.file:
|
||||
path: "{{ ecaas_agent_state }}{{ item }}"
|
||||
state: directory
|
||||
owner: "{{ username }}"
|
||||
group: "{{ user_group }}"
|
||||
mode: "0700"
|
||||
loop:
|
||||
- ""
|
||||
- /ai
|
||||
- /claude
|
||||
- /cline
|
||||
- /cline/data
|
||||
- /cline/data/settings
|
||||
|
||||
- name: Locate supported WSL agent configuration
|
||||
ansible.builtin.stat:
|
||||
path: "{{ user_home }}/{{ item.src }}"
|
||||
follow: false
|
||||
get_checksum: false
|
||||
get_mime: false
|
||||
loop: "{{ ecaas_agent_config }}"
|
||||
register: ecaas_agent_config_sources
|
||||
|
||||
- name: Seed missing private agent settings without importing credential stores
|
||||
ansible.builtin.copy:
|
||||
src: "{{ user_home }}/{{ item.item.src }}{{ '/' if item.stat.isdir | default(false) else '' }}"
|
||||
dest: "{{ ecaas_agent_state }}/{{ item.item.dest }}"
|
||||
remote_src: true
|
||||
mode: preserve
|
||||
force: false
|
||||
local_follow: false
|
||||
become_user: "{{ username }}"
|
||||
when:
|
||||
- item.stat.isreg | default(false) or item.stat.isdir | default(false)
|
||||
- not ansible_check_mode
|
||||
loop: "{{ ecaas_agent_config_sources.results }}"
|
||||
no_log: true
|
||||
diff: false
|
||||
|
||||
- name: Deploy the ecaas dev container configuration
|
||||
ansible.builtin.template:
|
||||
src: ecaas-devcontainer.json.j2
|
||||
dest: "{{ workstation_ecaas_workspace }}/.devcontainer/devcontainer.json"
|
||||
owner: "{{ username }}"
|
||||
group: "{{ user_group }}"
|
||||
mode: "0644"
|
||||
backup: true
|
||||
|
||||
- name: Deploy the ecaas dev container build files
|
||||
ansible.builtin.copy:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ workstation_ecaas_workspace }}/.devcontainer/{{ item.dest }}"
|
||||
owner: "{{ username }}"
|
||||
group: "{{ user_group }}"
|
||||
mode: "0644"
|
||||
backup: true
|
||||
loop:
|
||||
- src: ecaas-devcontainer.Dockerfile
|
||||
dest: Dockerfile
|
||||
- src: "{{ playbook_dir }}/../dotfiles/common/.bashrc"
|
||||
dest: bashrc
|
||||
loop_control:
|
||||
label: "{{ item.dest }}"
|
||||
@@ -0,0 +1,65 @@
|
||||
---
|
||||
- name: Locate the Git CA files configured for the workstation
|
||||
ansible.builtin.stat:
|
||||
path: "{{ user_home }}/.local/share/certs/{{ item.certificate }}"
|
||||
follow: true
|
||||
get_checksum: false
|
||||
get_mime: false
|
||||
loop: "{{ workstation_git_https_cas }}"
|
||||
loop_control:
|
||||
label: "{{ item.certificate }}"
|
||||
register: ecaas_git_ca_probe
|
||||
|
||||
- name: Require the ecaas Git CA before deploying the dev container
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- workstation_ecaas_git_required_ca in (ecaas_git_available_cas | map(attribute='certificate') | list)
|
||||
fail_msg: "Install the existing workstation CA at {{ user_home }}/.local/share/certs/{{ workstation_ecaas_git_required_ca }} first."
|
||||
|
||||
- name: Verify the available Git CA files are public PEM certificates
|
||||
ansible.builtin.shell: |
|
||||
if grep -q -- 'PRIVATE KEY-----' "$ECAAS_GIT_CA"; then
|
||||
exit 1
|
||||
fi
|
||||
openssl x509 -in "$ECAAS_GIT_CA" -noout
|
||||
environment:
|
||||
ECAAS_GIT_CA: "{{ user_home }}/.local/share/certs/{{ item.item.certificate }}"
|
||||
become_user: "{{ username }}"
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
when: item.stat.isreg | default(false)
|
||||
loop: "{{ ecaas_git_ca_probe.results }}"
|
||||
loop_control:
|
||||
label: "{{ item.item.certificate }}"
|
||||
|
||||
- name: Ensure the private ecaas Git configuration directory exists
|
||||
ansible.builtin.file:
|
||||
path: "{{ ecaas_agent_state }}/git"
|
||||
state: directory
|
||||
owner: "{{ username }}"
|
||||
group: "{{ user_group }}"
|
||||
mode: "0700"
|
||||
|
||||
- name: Render the workstation Git configuration for the ecaas container
|
||||
ansible.builtin.template:
|
||||
src: "{{ playbook_dir }}/templates/workstation/.gitconfig.j2"
|
||||
dest: "{{ ecaas_agent_state }}/git/gitconfig"
|
||||
owner: "{{ username }}"
|
||||
group: "{{ user_group }}"
|
||||
mode: "0600"
|
||||
vars:
|
||||
workstation_git_in_devcontainer: true
|
||||
workstation_git_container_cas: "{{ ecaas_git_available_cas }}"
|
||||
no_log: true
|
||||
diff: false
|
||||
|
||||
- name: Deploy the workstation Git ignore and delta theme files
|
||||
ansible.builtin.copy:
|
||||
src: "{{ playbook_dir }}/../dotfiles/workstation/{{ item }}"
|
||||
dest: "{{ ecaas_agent_state }}/git/{{ item }}"
|
||||
owner: "{{ username }}"
|
||||
group: "{{ user_group }}"
|
||||
mode: "0644"
|
||||
loop:
|
||||
- .gitignore_global
|
||||
- .themes.gitignore
|
||||
@@ -1,4 +1,9 @@
|
||||
---
|
||||
- name: Deploy the ecaas Java 11 dev container
|
||||
ansible.builtin.import_tasks: ecaas_devcontainer.yml
|
||||
when: workstation_ecaas_workspace is defined
|
||||
tags: [ecaas_devcontainer]
|
||||
|
||||
- name: Ensure Windows Emacs authoring directories exist
|
||||
tags: [dotfiles, dotfiles:workstation, emacs, wsl]
|
||||
ansible.builtin.file:
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"name": "ecaas — Java 11",
|
||||
"build": {
|
||||
"dockerfile": "Dockerfile",
|
||||
"args": {
|
||||
"MAVEN_VERSION": {{ workstation_mise_maven_version | to_json }}
|
||||
}
|
||||
},
|
||||
"remoteUser": "vscode",
|
||||
"updateRemoteUserUID": true,
|
||||
"containerEnv": {
|
||||
"CLAUDE_CONFIG_DIR": "/home/vscode/.claude"
|
||||
},
|
||||
"mounts": [
|
||||
{{ ('type=bind,source=' ~ ecaas_agent_state ~ '/git,target=/run/ecaas-git,readonly') | to_json }},
|
||||
{% for ca in ecaas_git_available_cas %}
|
||||
{{ ('type=bind,source=' ~ user_home ~ '/.local/share/certs/' ~ ca.certificate ~ ',target=/run/ecaas-git-ca/' ~ ca.certificate ~ ',readonly') | to_json }},
|
||||
{% endfor %}
|
||||
{{ ('type=bind,source=' ~ ecaas_agent_state ~ '/ai,target=/home/vscode/.config/ai,readonly') | to_json }},
|
||||
{{ ('type=bind,source=' ~ ecaas_agent_state ~ '/claude,target=/home/vscode/.claude') | to_json }},
|
||||
{{ ('type=bind,source=' ~ ecaas_agent_state ~ '/cline,target=/home/vscode/.cline') | to_json }}
|
||||
],
|
||||
"forwardPorts": [8080],
|
||||
"customizations": {
|
||||
"vscode": {
|
||||
"extensions": [
|
||||
"vscjava.vscode-java-pack",
|
||||
"vmware.vscode-boot-dev-pack",
|
||||
"redhat.vscode-xml",
|
||||
"redhat.vscode-yaml",
|
||||
"anthropic.claude-code",
|
||||
"saoudrizwan.claude-dev"
|
||||
],
|
||||
"settings": {
|
||||
"java.jdt.ls.java.home": "/opt/jdk-21",
|
||||
"spring-boot.ls.java.home": "/opt/jdk-21",
|
||||
"java.configuration.runtimes": [
|
||||
{
|
||||
"name": "JavaSE-11",
|
||||
"path": "/usr/lib/jvm/msopenjdk-current",
|
||||
"default": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user