From 3f533570caf013089d3d1b0d4c3b21e85dc4012d Mon Sep 17 00:00:00 2001 From: Oleg Chepelev Date: Tue, 1 Oct 2024 16:14:41 +0000 Subject: [PATCH] add devconatiner stuff add lazygit for devconatiner remove expose ports from dockerfile --- .devcontainer/devcontainer.json | 7 +++++++ Dockerfile | 34 +++++++++++++++++++++++++++++++++ docker-compose.yaml | 17 +++++++++++++++++ 3 files changed, 58 insertions(+) create mode 100644 .devcontainer/devcontainer.json create mode 100644 Dockerfile create mode 100644 docker-compose.yaml diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000000..55c484fb658 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,7 @@ +{ + "name": "Adguard", + "dockerComposeFile": "../docker-compose.yaml", + "service": "adguard", + "workspaceFolder": "/adguard/${localWorkspaceFolderBasename}", + "remoteUser": "node" +} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000000..285b8c5539e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,34 @@ +FROM node:18 + +RUN apt-get update && apt-get install fish mc vim curl sudo tmux -y && \ + echo "fish" >>~/.bashrc + +RUN echo 'root:123' | chpasswd +RUN echo 'node:123' | chpasswd + +RUN sudo usermod -a -G sudo node + +USER node + +# customize tmux +RUN cd && \ + git clone https://github.com/gpakosz/.tmux.git && \ + ln -s -f .tmux/.tmux.conf && \ + cp .tmux/.tmux.conf.local . + +# upd configs for cli tools +RUN echo "fish" >>~/.bashrc +RUN mkdir -p ~/.config/fish +RUN echo "alias tmux='tmux -2'" >>~/.config/fish/config.fish +RUN echo "set -U fish_prompt_pwd_dir_length 0" >>~/.config/fish/config.fish + +# install lazygit +RUN wget https://github.com/jesseduffield/lazygit/releases/download/v$(curl -s "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | grep -Po '"tag_name": "v\K[^"]*')/lazygit_$(curl -s "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | grep -Po '"tag_name": "v\K[^"]*')_Linux_32-bit.tar.gz -P ~/.lazygit/ +RUN tar -xf ~/.lazygit/lazygit_$(curl -s "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | grep -Po '"tag_name": "v\K[^"]*')_Linux_32-bit.tar.gz -C ~/.lazygit/ +RUN echo "alias lazygit='~/.lazygit/lazygit'" >>~/.config/fish/config.fish +RUN echo "alias lz='~/.lazygit/lazygit'" >>~/.config/fish/config.fish +RUN git config --global core.autocrlf true +RUN git config --global --add safe.directory '*' + +WORKDIR /app + diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 00000000000..a24cb5aad2a --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,17 @@ +version: "3.1" + +services: + adguard: + extra_hosts: + - "host.docker.internal:host-gateway" + container_name: adguard + build: + context: ./ + dockerfile: ./Dockerfile + volumes: + - ..:/adguard:cached + tty: true + stdin_open: true + restart: on-failure + command: sleep infinity + \ No newline at end of file