-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add vscode dev container config. (#587)
- Loading branch information
Showing
3 changed files
with
116 additions
and
2 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,60 @@ | ||
FROM ubuntu:focal | ||
|
||
# This Dockerfile adds a non-root 'vscode' user with sudo access. However, for Linux, | ||
# this user's GID/UID must match your local user UID/GID to avoid permission issues | ||
# with bind mounts. Update USER_UID / USER_GID if yours is not 1000. See | ||
# https://aka.ms/vscode-remote/containers/non-root-user for details. | ||
ARG USERNAME=vscode | ||
ARG USER_UID=1000 | ||
ARG USER_GID=${USER_UID} | ||
|
||
# Avoid warnings by switching to noninteractive | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN apt-get update && apt-get upgrade -qy && apt-get install -qy \ | ||
apt-utils \ | ||
ca-certificates\ | ||
locales \ | ||
curl \ | ||
git \ | ||
make \ | ||
python-is-python3 \ | ||
python3 \ | ||
python3-pip \ | ||
ruby \ | ||
fish && \ | ||
apt-get autoclean -y && \ | ||
apt-get autoremove -y && \ | ||
apt-get clean | ||
|
||
# Install xdrgen | ||
RUN cd /opt && \ | ||
git clone --branch python-sdk https://github.com/overcat/xdrgen && \ | ||
cd xdrgen && \ | ||
gem build xdrgen.gemspec && \ | ||
gem install xdrgen-*.gem | ||
|
||
# Install poetry | ||
RUN pip install poetry | ||
|
||
# Set up locale | ||
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \ | ||
&& locale-gen | ||
ENV LANG en_US.UTF-8 | ||
ENV LANGUAGE en_US:en | ||
ENV LC_ALL en_US.UTF-8 | ||
|
||
# Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user. | ||
RUN groupadd --gid $USER_GID $USERNAME \ | ||
&& useradd -s /bin/fish --uid $USER_UID --gid $USER_GID -m $USERNAME \ | ||
# [Optional] Add sudo support for the non-root user | ||
&& apt-get install -y sudo \ | ||
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME\ | ||
&& chmod 0440 /etc/sudoers.d/$USERNAME | ||
|
||
# Switch back to dialog for any ad-hoc use of apt-get | ||
ENV DEBIAN_FRONTEND= | ||
|
||
USER $USERNAME | ||
|
||
CMD ["/bin/fish"] |
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,46 @@ | ||
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or the definition README at | ||
// https://github.com/microsoft/vscode-dev-containers/tree/master/containers/ubuntu-18.04-git | ||
{ | ||
"name": "Stellar Python SDK Dev", | ||
"dockerFile": "Dockerfile", | ||
"build": { | ||
"args": {} | ||
}, | ||
// https://code.visualstudio.com/remote/advancedcontainers/environment-variables | ||
"remoteEnv": { | ||
// "PIP_INDEX_URL": "https://mirrors.ustc.edu.cn/pypi/web/simple" | ||
}, | ||
// The optional 'runArgs' property can be used to specify additional runtime arguments. | ||
"runArgs": [], | ||
// Use 'settings' to set *default* container specific settings.json values on container create. | ||
// You can edit these settings after create using File > Preferences > Settings > Remote. | ||
"settings": { | ||
"terminal.integrated.profiles.linux": { | ||
"bash": { | ||
"path": "/bin/bash" | ||
}, | ||
"fish": { | ||
"path": "/bin/fish" | ||
} | ||
}, | ||
"terminal.integrated.defaultProfile.linux": "fish" | ||
}, | ||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [3000], | ||
// Use 'portsAttributes' to set default properties for specific forwarded ports. More info: https://code.visualstudio.com/docs/remote/devcontainerjson-reference. | ||
// "portsAttributes": { | ||
// }, | ||
// Use 'otherPortsAttributes' to configure any ports that aren't configured using 'portsAttributes'. | ||
// "otherPortsAttributes": { | ||
// "onAutoForward": "silent" | ||
// }, | ||
// Uncomment the next line to run commands after the container is created. | ||
"postCreateCommand": "poetry install", | ||
"postAttachCommand": "poetry shell", | ||
// Add the IDs of extensions you want installed when the container is created in the array below. | ||
"extensions": ["donjayamanne.python-extension-pack"], | ||
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. | ||
// On Linux, this will prevent new files getting created as root, but you may need to update the USER_UID | ||
// and USER_GID in .devcontainer/Dockerfile to match your user if not 1000. | ||
"remoteUser": "vscode" | ||
} |
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