Skip to content

Instantly share code, notes, and snippets.

@phelewski
phelewski / devcontainer.json
Last active May 12, 2020 14:42
Visual Studios Code Remote - Container Blog | Persist Bash History Mount
"mounts": [
"source=project_name-bash_history,target=/commandhistory,type=volume",
],
@phelewski
phelewski / Dockerfile
Created May 12, 2020 14:37
Visual Studios Code Remote - Container Blog | Persist Bash History
RUN SNIPPET="export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhistory/.bash_history" \
&& mkdir /commandhistory \
  && touch /commandhistory/.bash_history \
  && chown -R $USERNAME /commandhistory \
  && echo $SNIPPET >> "/home/$USERNAME/.bashrc"
@phelewski
phelewski / Dockerfile
Created May 12, 2020 14:36
Visual Studios Code Remote - Container Blog | Example non-root User with sudo
&& apt-get install -y sudo \
&& echo $USERNAME ALL=\(root\) NOPASSWD:/usr/sbin/foo > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME
@phelewski
phelewski / Dockerfile
Created May 12, 2020 14:35
Visual Studios Code Remote - Container Blog | Example non-root User
ARG USERNAME=cfn_nag_dev
ARG USER_UID=1000
ARG USER_GID=$USER_UID
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID --shell /bin/bash -m $USERNAME
@phelewski
phelewski / devcontainer.json
Created May 12, 2020 14:31
Visual Studios Code Remote - Container Blog | remote.containers.workspaceMountConsistency
"remote.containers.workspaceMountConsistency": "consistent",
@phelewski
phelewski / devcontainer.json
Created March 12, 2020 16:14
Visual Studios Code Remote - Container Blog | Example devcontainer.json
{
"name": "Ruby Development",
"dockerFile": "Dockerfile",
"appPort": 9001,
"extensions": [
"rebornix.Ruby"
],
"settings": {
"[ruby]": {
"editor.insertSpaces": true,
@phelewski
phelewski / tree
Created March 10, 2020 19:56
Visual Studios Code Remote - Container Blog | Example Ruby Project tree
.
├── .devcontainer
│   ├── .devcontainer.json
│   └── Dockerfile
├── Gemfile
├── Gemfile.lock
├── LICENSE.md
├── README.md
├── bin
│   └── foo
@phelewski
phelewski / devcontainer.json
Created March 9, 2020 13:05
Visual Studios Code Remote - Container Blog | Example Ruby Project devcontainer.json postCreateCommand Partial
{
"postCreateCommand": "bundle install"
}
@phelewski
phelewski / devcontainer.json
Created March 9, 2020 13:04
Visual Studios Code Remote - Container Blog | Example Ruby Project devcontainer.json YAML Partial
{
"extensions": [
"redhat.vscode-yaml"
],
"settings": {
"yaml.format.singleQuote": true,
"yaml.customTags": [
"!And sequence",
"!Cidr sequence",
"!Equals sequence",
@phelewski
phelewski / devcontainer.json
Created March 9, 2020 13:03
Visual Studios Code Remote - Container Blog | Example Ruby Project devcontainer.json Spaces & Tabs Partial
{
"settings": {
"[ruby]": {
"editor.insertSpaces": true,
"editor.tabSize": 2
},
"[yaml]": {
"editor.insertSpaces": true,
"editor.tabSize": 2
},