From 9f33389e83b01891227ec9a8cd94b49ecbf6b195 Mon Sep 17 00:00:00 2001 From: mike <219478+ilude@users.noreply.github.com> Date: Mon, 25 Mar 2024 11:31:46 -0400 Subject: [PATCH] merge changes from onboard devcontainer setup --- .devcontainer/ansible/roles/setup-container/defaults/main.yml | 4 ++-- .../ansible/roles/setup-container/tasks/dotfiles.yml | 4 +++- .devcontainer/devcontainer.json | 1 + Dockerfile | 2 ++ 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.devcontainer/ansible/roles/setup-container/defaults/main.yml b/.devcontainer/ansible/roles/setup-container/defaults/main.yml index 73fbc2b..d8568c0 100644 --- a/.devcontainer/ansible/roles/setup-container/defaults/main.yml +++ b/.devcontainer/ansible/roles/setup-container/defaults/main.yml @@ -1,2 +1,2 @@ -dotfiles_url: "{{ lookup('env', 'DOTFILES_URL') | default('https://github.com/ilude/dotfiles.git') }}" -dotfiles_path: "{{ lookup('env', 'HOME') + '/.dotfiles' }}" +dotfiles_url: "{{ lookup('env', 'DOTFILES_URL') }}" +dotfiles_path: "{{ lookup('env', 'HOME') + '/.dotfiles' }}" \ No newline at end of file diff --git a/.devcontainer/ansible/roles/setup-container/tasks/dotfiles.yml b/.devcontainer/ansible/roles/setup-container/tasks/dotfiles.yml index e17b74e..04a3a47 100644 --- a/.devcontainer/ansible/roles/setup-container/tasks/dotfiles.yml +++ b/.devcontainer/ansible/roles/setup-container/tasks/dotfiles.yml @@ -1,4 +1,4 @@ -- name: Clone/Update Dotfiles Repository +- name: Clone/Update git repo {{ dotfiles_url }} to {{ dotfiles_path }} git: repo: "{{ dotfiles_url }}" dest: "{{ dotfiles_path }}" @@ -6,6 +6,8 @@ update: yes force: yes accept_hostkey: yes + ignore_errors: yes - name: Execute {{ dotfiles_path }}/install command: "{{ dotfiles_path }}/install" + ignore_errors: yes diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 98ee50a..f0566ce 100755 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -18,6 +18,7 @@ "PROJECT_PATH": "${containerWorkspaceFolder}" } }, + "initializeCommand": "touch ${localWorkspaceFolder}/.devcontainer/.env", "updateContentCommand": "LC_ALL=C.UTF-8 ansible-playbook --inventory 127.0.0.1 --connection=local ${containerWorkspaceFolder}/.devcontainer/ansible/setup-container.yml", "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", "runArgs": ["--name", "${localWorkspaceFolderBasename}_devcontainer", "--hostname", "${localWorkspaceFolderBasename}","--env-file",".devcontainer/.env" ], diff --git a/Dockerfile b/Dockerfile index 78da38a..8643737 100755 --- a/Dockerfile +++ b/Dockerfile @@ -159,6 +159,8 @@ RUN echo ${USER} ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/${USER} && \ ARG PROJECT_NAME ENV PROJECT_NAME=${PROJECT_NAME} +ENV DOTFILES_URL=https://github.com/ilude/dotfiles.git + USER ${USER} # https://code.visualstudio.com/remote/advancedcontainers/start-processes#_adding-startup-commands-to-the-docker-image-instead