-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update pyproject.toml * annofab v0.111.0 * add devcontainer * add devcontainer * add devcontainer * add vscode setting * update make * ignore pattern
- Loading branch information
1 parent
1a8c25e
commit 0623194
Showing
7 changed files
with
228 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* | ||
!.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
FROM ubuntu:18.04 as devcontainer | ||
|
||
RUN set -x \ | ||
&& apt-get update \ | ||
&& apt-get install -y --no-install-recommends \ | ||
ca-certificates \ | ||
&& apt-get clean && rm -rf /var/cache/apt/archives/* /var/lib/apt/lists/* | ||
|
||
RUN set -x \ | ||
&& apt-get update \ | ||
&& apt-get install -y --no-install-recommends \ | ||
tzdata \ | ||
&& apt-get clean && rm -rf /var/cache/apt/archives/* /var/lib/apt/lists/* \ | ||
&& ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtime \ | ||
&& echo 'Asia/Tokyo' >/etc/timezone | ||
|
||
# create vscode user | ||
RUN set -x \ | ||
&& apt-get update \ | ||
&& apt-get install -y --no-install-recommends \ | ||
sudo \ | ||
&& apt-get clean && rm -rf /var/cache/apt/archives/* /var/lib/apt/lists/* \ | ||
&& echo "vscode ALL=(ALL) NOPASSWD:ALL" >>/etc/sudoers.d/ALL \ | ||
&& groupadd \ | ||
--gid 5000 \ | ||
vscode \ | ||
&& useradd \ | ||
--uid 5000 \ | ||
--gid 5000 \ | ||
--home-dir /home/vscode \ | ||
--create-home \ | ||
--shell /bin/bash \ | ||
vscode | ||
|
||
# vscode extensions cache | ||
# https://code.visualstudio.com/docs/remote/containers-advanced#_avoiding-extension-reinstalls-on-container-rebuild | ||
RUN set -x \ | ||
&& mkdir -p /home/vscode/.vscode-server/extensions /home/vscode/.vscode-server-insiders \ | ||
&& chown -R vscode:vscode /home/vscode/.vscode-server /home/vscode/.vscode-server-insiders \ | ||
&& ln -s /home/vscode/.vscode-server/extensions /home/vscode/.vscode-server-insiders/extensions | ||
|
||
# common tools | ||
RUN set -x \ | ||
&& apt-get update \ | ||
&& apt-get install -y --no-install-recommends \ | ||
bash-completion \ | ||
curl \ | ||
git \ | ||
gnupg2 \ | ||
iputils-ping \ | ||
jq \ | ||
less \ | ||
net-tools \ | ||
openssh-client \ | ||
tar \ | ||
time \ | ||
unzip \ | ||
xz-utils \ | ||
zip \ | ||
&& apt-get clean && rm -rf /var/cache/apt/archives/* /var/lib/apt/lists/* | ||
|
||
# docker | ||
RUN set -x \ | ||
&& apt-get update \ | ||
&& apt-get install -y --no-install-recommends \ | ||
apt-transport-https \ | ||
ca-certificates \ | ||
curl \ | ||
gnupg-agent \ | ||
software-properties-common \ | ||
&& curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - \ | ||
&& add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \ | ||
&& apt-get update \ | ||
&& apt-get install -y --no-install-recommends \ | ||
docker-ce-cli \ | ||
&& apt-get clean && rm -rf /var/cache/apt/archives/* /var/lib/apt/lists/* \ | ||
&& groupadd --gid 999 docker \ | ||
&& usermod -aG docker vscode | ||
|
||
# docker compose | ||
ARG COMPOSE_VERSION=1.27.4 | ||
RUN set -x \ | ||
&& apt-get update \ | ||
&& apt-get install -y --no-install-recommends \ | ||
curl \ | ||
&& apt-get clean && rm -rf /var/cache/apt/archives/* /var/lib/apt/lists/* \ | ||
&& curl -fsSL "https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose \ | ||
&& chmod +x /usr/local/bin/docker-compose \ | ||
&& curl -fsSL -o /etc/bash_completion.d/docker-compose "https://raw.githubusercontent.com/docker/compose/${COMPOSE_VERSION}/contrib/completion/bash/docker-compose" | ||
|
||
# docker / docker-compose in devcontainer | ||
RUN set -x \ | ||
&& mkdir -p /usr/local/devcontainer-tool/bin \ | ||
&& curl -fsSL -o /usr/local/devcontainer-tool/bin/docker https://raw.githubusercontent.com/thamaji/devcontainer-docker/main/docker \ | ||
&& chmod +x /usr/local/devcontainer-tool/bin/docker \ | ||
&& curl -fsSL -o /usr/local/devcontainer-tool/bin/docker-compose https://github.com/thamaji/devcontainer-compose/releases/download/v1.0.0/docker-compose \ | ||
&& chmod +x /usr/local/devcontainer-tool/bin/docker-compose | ||
ENV PATH=/usr/local/devcontainer-tool/bin:${PATH} | ||
|
||
# python3.8, make | ||
RUN set -x \ | ||
&& apt-get update \ | ||
&& apt-get install -y --no-install-recommends \ | ||
python3.8 \ | ||
python3-distutils \ | ||
make \ | ||
&& apt-get clean && rm -rf /var/cache/apt/archives/* /var/lib/apt/lists/* \ | ||
&& ln -s $(which python3.8) /usr/local/bin/python | ||
|
||
# pip | ||
RUN set -x \ | ||
&& curl -sSL https://bootstrap.pypa.io/get-pip.py | sudo -u vscode -i python - | ||
|
||
# poetry | ||
RUN set -x \ | ||
&& curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | sudo -u vscode -i python - \ | ||
&& sudo -u vscode -i /home/vscode/.local/bin/poetry config virtualenvs.in-project true | ||
ENV PATH=$PATH:/home/vscode/.local/bin | ||
|
||
# fix poetry issue (see: https://github.com/python-poetry/poetry/issues/221) | ||
RUN set -x \ | ||
&& apt-get update \ | ||
&& apt-get install -y --no-install-recommends \ | ||
language-pack-en \ | ||
&& apt-get clean && rm -rf /var/cache/apt/archives/* /var/lib/apt/lists/* | ||
ENV LC_ALL=C.UTF-8 | ||
|
||
|
||
USER vscode | ||
|
||
ADD entrypoint.sh /entrypoint.sh | ||
ENTRYPOINT [ "bash", "-eux", "/entrypoint.sh" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: | ||
// https://github.com/microsoft/vscode-dev-containers/tree/v0.154.0/containers/docker-existing-dockerfile | ||
{ | ||
"name": "Existing Dockerfile", | ||
"build": { | ||
"dockerfile": "Dockerfile", | ||
"context": ".", | ||
"args": {}, | ||
"target": "devcontainer" | ||
}, | ||
"containerUser": "vscode", | ||
"remoteUser": "vscode", | ||
"updateRemoteUserUID": true, | ||
"overrideCommand": false, | ||
"mounts": [ | ||
"source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind", | ||
"source=${localWorkspaceFolder}/.devcontainer/.extensions,target=/home/vscode/.vscode-server/extensions,type=bind" | ||
], | ||
"forwardPorts": [], | ||
"runArgs": [ | ||
"--init", | ||
"--net=host" | ||
], | ||
"postStartCommand": "poetry install", | ||
"extensions": [ | ||
"mosapride.zenkaku", | ||
"ms-python.python", | ||
"ms-python.vscode-pylance", | ||
"streetsidesoftware.code-spell-checker" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
set -eu | ||
|
||
# docker.sock から gid を取得して、docker グループの gid を変更 | ||
docker_group_id=$(ls -n /var/run/docker.sock | cut -d ' ' -f 4) | ||
sudo groupmod --gid ${docker_group_id} docker | ||
|
||
# 無限待ち(vscode デフォルトの entrypoint と同じ方法で) | ||
while sleep 1000; do :; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -107,7 +107,7 @@ venv.bak/ | |
.idea/ | ||
|
||
# Visual Studio Code | ||
.vscode | ||
# .vscode | ||
|
||
|
||
# temporary directory | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
{ | ||
"python.linting.pylintEnabled": true, | ||
"python.autoComplete.extraPaths": [ | ||
".venv/lib/python3.8/site-packages/" | ||
], | ||
|
||
"python.formatting.blackPath": ".venv/bin/black", | ||
"python.formatting.provider": "black", | ||
"python.linting.enabled": true, | ||
"python.linting.lintOnSave": true, | ||
"python.linting.pylintPath": ".venv/bin/pylint", | ||
"python.linting.pylintArgs": [ | ||
"--rcfile setup.cfg", | ||
], | ||
"python.linting.flake8Enabled": true, | ||
"python.linting.flake8Path": ".venv/bin/flake8", | ||
"python.linting.flake8Args": [], | ||
"python.linting.mypyEnabled": true, | ||
"python.linting.mypyPath": ".venv/bin/mypy", | ||
"python.linting.mypyArgs": [], | ||
"python.linting.banditEnabled": false, | ||
"python.linting.pylamaEnabled": false, | ||
"python.linting.prospectorEnabled": false, | ||
"python.linting.pydocstyleEnabled": false, | ||
"python.linting.pycodestyleEnabled": false, | ||
"python.linting.ignorePatterns": [ | ||
".vscode/*.py", | ||
"**/site-packages/**/*.py" | ||
], | ||
"python.analysis.extraPaths": [ | ||
".venv/lib/python3.8/site-packages/" | ||
], | ||
"python.analysis.completeFunctionParens": true, | ||
"[python]": { | ||
"editor.formatOnSave": true, | ||
"editor.codeActionsOnSave": { | ||
"source.organizeImports": true | ||
}, | ||
}, | ||
"cSpell.ignorePaths": [ | ||
"**/.git/objects/**", | ||
".devcontainer/", | ||
".vscode/" | ||
], | ||
"cSpell.words": [ | ||
"pylint", | ||
"asyncio" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters