forked from aws/aws-parallelcluster-cookbook
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add developer environment for vscode
Problem: as a new developer it is hard to setup a local environment Solution: provide a .devcontainer setup, including ruby, chef resources, Python, and tox, and a brief note about using the environment in the CONTRIBUTING.md Signed-off-by: vsoch <[email protected]>
- Loading branch information
Showing
3 changed files
with
109 additions
and
0 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,41 @@ | ||
FROM ruby:2.7 | ||
|
||
LABEL maintainer="Amazon Web Services" | ||
|
||
# Match the default user id for a single system so we aren't root | ||
ARG USERNAME=vscode | ||
ARG USER_UID=1000 | ||
ARG USER_GID=1000 | ||
ENV USERNAME=${USERNAME} | ||
ENV USER_UID=${USER_UID} | ||
ENV USER_GID=${USER_GID} | ||
|
||
# Assuming extra libs could be installed to /usr/local | ||
ENV LD_LIBRARY_PATH=/usr/local/lib | ||
|
||
RUN apt-get update \ | ||
&& apt-get -qq install -y --no-install-recommends \ | ||
sudo \ | ||
python3-pip \ | ||
python3 && \ | ||
pip3 install tox && \ | ||
ln -s /usr/bin/python3 /usr/bin/python && \ | ||
apt-get clean | ||
|
||
ENV CHEF_LICENSE=accept-no-persist | ||
|
||
# Done so does not fail if missing Gemfile.lock | ||
COPY ./Gemfile* /tmp/ | ||
RUN cd /tmp && \ | ||
bundle config set with 'style' && \ | ||
bundle install && \ | ||
curl -L https://omnitruck.cinc.sh/install.sh -o chefDownload.sh && \ | ||
chmod +x chefDownload.sh && \ | ||
./chefDownload.sh -c stable -P cinc-workstation | ||
|
||
# Add the group and user that match our ids | ||
RUN groupadd -g ${USER_GID} ${USERNAME} && \ | ||
adduser --disabled-password --uid ${USER_UID} --gid ${USER_GID} --gecos "" ${USERNAME} && \ | ||
echo "${USERNAME} ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers | ||
USER $USERNAME | ||
ENV PATH=/opt/chef-workstation/embedded/bin:$PATH |
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,33 @@ | ||
{ | ||
"name": "AWS ParallelCluster Cookbook Developer Environment", | ||
"dockerFile": "Dockerfile", | ||
"context": "../", | ||
|
||
"customizations": { | ||
"vscode": { | ||
"settings": { | ||
"terminal.integrated.defaultProfile.linux": "bash", | ||
|
||
// Ensure that Python autocomplete works out of the box | ||
"python.autoComplete.extraPaths": [ | ||
"/usr/local/lib/python3.8/site-packages" | ||
], | ||
"python.analysis.extraPaths": [ | ||
"/usr/local/lib/python3.8/site-packages" | ||
] | ||
}, | ||
// Note to Flux Developers! We can add extensions here that you like | ||
"extensions": [ | ||
"ms-python.python", // Python support | ||
"GitHub.vscode-pull-request-github" // manage and review PRs | ||
] | ||
} | ||
}, | ||
"features": { | ||
"ghcr.io/devcontainers/features/github-cli:1": { | ||
"version": "latest" | ||
} | ||
}, | ||
// Needed for git security feature (this assumes you locally cloned to flux-core) | ||
"postStartCommand": "git config --global --add safe.directory /workspaces/aws-parallelcluster-cookbook" | ||
} |
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