Skip to content

Commit

Permalink
update devcontainer build
Browse files Browse the repository at this point in the history
  • Loading branch information
ilude committed Apr 25, 2024
1 parent 3f976a6 commit 938259c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 30 deletions.
9 changes: 6 additions & 3 deletions .devcontainer/ansible/roles/setup-container/tasks/ssh.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
- name: et permissions on ~/.ssh
- name: Set permissions on ~/.ssh
file:
path: "{{ lookup('env', 'HOME') + '/.ssh' }}"
path: "'~/.ssh' }}"
state: directory
owner: "{{ lookup('env', 'USER') }}"
group: "{{ lookup('env', 'USER') }}"
recurse: true
mode: '0700'
become: true

- name: Set permissions for ~/.ssh files

file:
path: "{{ item }}"
mode: '0600'
owner: "{{ lookup('env', 'USER') }}"
group: "{{ lookup('env', 'USER') }}"
become: true
with_fileglob:
- "{{ lookup('env', 'HOME') }}/.ssh/*"
- "~/.ssh/*"

- name: Setup and start ssh-agent
shell: |
Expand Down
12 changes: 1 addition & 11 deletions .devcontainer/ansible/setup-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,6 @@
hosts: localhost
connection: local
gather_facts: true
vars:
# docker defaults
docker_edition: 'ce'
docker_package_state: present
docker_service_manage: false
docker_install_compose_plugin: true
docker_compose_package: docker-compose-plugin
docker_compose_package_state: present

docker_users:
- "{{ lookup('env', 'USER') }}"
ignore_errors: true
roles:
- role: setup-container
14 changes: 1 addition & 13 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,10 @@
"ms-python.isort"
],
"settings": {
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.detectIndentation": false,
"editor.insertSpaces": false,
"editor.tabSize": 2
},
"files.exclude": {
"**/.dotnet": true,
"**/.zcompdump": true
},
"dev.containers.copyGitConfig": false,
"dev.containers.gitCredentialHelperConfigLocation": "system",
"editor.tabSize": 2,
"files.readonlyFromPermissions": true,
"python.analysis.extraPaths": [ "${containerWorkspaceFolder}/app" ],
"terminal.external.windowsExec": "C:\\Program Files\\PowerShell\\7\\pwsh.exe",
"terminal.integrated.defaultProfile.linux": "zsh",
"terminal.integrated.defaultProfile.windows": "pwsh",
"terminal.integrated.profiles.linux": {
Expand All @@ -88,7 +76,7 @@
},
"terminal.integrated.tabs.description": "",
"terminal.integrated.tabs.title": "${local}${separator}${cwdFolder}${separator}${process}",
"window.title": "${localWorkspaceFolderBasename}"
"window.title": "${localWorkspaceFolderBasename} ${process}"
}
}
}
Expand Down
8 changes: 5 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
echo ${USER} ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/${USER} && \
chmod 0440 /etc/sudoers.d/${USER}

COPY .devcontainer .devcontainer

RUN LC_ALL=C.UTF-8 ansible-playbook --inventory 127.0.0.1 --connection=local .devcontainer/ansible/requirements.yml && \
LC_ALL=C.UTF-8 ansible-playbook --inventory 127.0.0.1 --connection=local .devcontainer/ansible/install-docker.yml

RUN apt-get update && apt-get install -y --no-install-recommends \
graphviz \
imagemagick \
Expand All @@ -192,9 +197,6 @@ RUN pip3 install --no-cache-dir --target=${PYTHON_DEPS_PATH} --no-deps --prefer-
RUN pip3 install --no-cache-dir --target=${PYTHON_DEPS_PATH} --prefer-binary pandas-datareader bottleneck scipy duckdb sqlalchemy pyautogui requests_cache statsmodels
#RUN pip3 install --no-cache-dir --target=${PYTHON_DEPS_PATH} gensim torch tensorflow

RUN LC_ALL=C.UTF-8 ansible-playbook --inventory 127.0.0.1 --connection=local .devcontainer/ansible/requirements.yml && \
LC_ALL=C.UTF-8 ansible-playbook --inventory 127.0.0.1 --connection=local .devcontainer/ansible/install-docker.yml

USER ${USER}

# https://code.visualstudio.com/remote/advancedcontainers/start-processes#_adding-startup-commands-to-the-docker-image-instead
Expand Down

0 comments on commit 938259c

Please sign in to comment.