Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add devcontainer feature #2983

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "Adguard",
"dockerComposeFile": "../docker-compose.yaml",
"service": "adguard",
"workspaceFolder": "/adguard/${localWorkspaceFolderBasename}",
"remoteUser": "node"
}
34 changes: 34 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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

17 changes: 17 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -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