Skip to content

Commit

Permalink
Improvements to the devcontainer (#1738)
Browse files Browse the repository at this point in the history
* Make sure line endings are handled right whether in a container or WSL
* Performance improvements to building Docker container
* Added recommended extensions for using devcontainer and following Microsoft docs guidelines
  • Loading branch information
heaths authored Aug 31, 2020
1 parent 6f934cc commit 1f185ab
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 46 deletions.
44 changes: 24 additions & 20 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,37 @@ FROM debian:10
ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID
ARG PORT=4000

# The port on which Jekyll will serve the site
EXPOSE ${PORT}

# ENV Variables required by Jekyll
ENV LANG=en_US.UTF-8
ENV LANGUAGE=en_US:en
ENV TZ=America/Chicago
ENV LC_ALL=en_US.UTF-8
ENV LANG=en_US.UTF-8
ENV LANGUAGE=en_US
ENV LANG=en_US.UTF-8 \
LANGUAGE=en_US:en \
LC_ALL=en_US.UTF-8 \
TZ=America/Chicago

# Install packages as root
USER root

# Install needed packages and setup non-root user. Use a separate RUN statement to add your own dependencies.
RUN apt-get update \
&& export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
#
# Install vim, git, process tools, lsb-release
&& apt-get install -y \
&& LANG=C LC_ALL=C apt-get -y install --no-install-recommends \
apt-utils \
dialog \
sudo \
#
# Install vim, git, process tools, lsb-release
git \
openssh-client \
less \
#
# Install ruby
&& apt-get install -y \
#
# Install ruby
make \
ruby-full \
build-essential \
build-essential \
zlib1g-dev \
locales \
#
Expand All @@ -49,8 +55,8 @@ RUN apt-get update \
# Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user.
&& groupadd --gid $USER_GID $USERNAME \
&& useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
# [Optional] Add sudo support for the non-root user
&& apt-get install -y sudo \
#
# Add sudo support for the non-root user
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME\
&& chmod 0440 /etc/sudoers.d/$USERNAME \
#
Expand All @@ -59,7 +65,5 @@ RUN apt-get update \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*

# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update \
# && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>
# Switch back to the non-root user
USER ${USERNAME}
32 changes: 17 additions & 15 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
{
"name": "Jekyll",
"dockerFile": "Dockerfile",
"name": "Jekyll",
"dockerFile": "Dockerfile",

// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [],
// Extensions we want installed when the container is created.
"extensions": [
"docsmsft.docs-authoring-pack",
"github.vscode-pull-request-github"
],

// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [4000],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [4000],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "bundle install",

// Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root.
// "remoteUser": "vscode"
// Install the bundle after the container is created.
"postCreateCommand": "bundle install",

// Do not run as root. See https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
}
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"docsmsft.docs-authoring-pack",
"github.vscode-pull-request-github",
"ms-vscode-remote.remote-containers"
]
}
8 changes: 4 additions & 4 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@
{
"label": "Serve",
"type": "shell",
"command": "bundle exec jekyll serve --livereload",
"command": "bundle exec jekyll serve -Iw --livereload",
"group": {
"kind": "test",
"isDefault": true
},
"isBackground": true,
"isBackground": true
},
{
"label": "Build",
"type": "shell",
"command": "bundle exec jekyll build",
"command": "bundle exec jekyll build -I",
"group": {
"kind": "build",
"isDefault": true
},
}
}
]
}
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ Codespaces is new technology that allows you to use a container as your developm

1. From the Azure SDK GitHub repo, click on the "Code -> Open with Codespaces" button.
1. Open a Terminal
1. Execute the following command and CTRL+Click the link generated. A new window will open with the Azure SDK website.
1. Execute the following command and `Ctrl+Click` the link generated. A new window will open with the Azure SDK website.

```
```bash
bundle exec jekyll serve
```

Expand All @@ -36,9 +36,9 @@ Codespaces is new technology that allows you to use a container as your developm
1. Install the [VS Code Remote Extension Pack](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.vscode-remote-extensionpack)
1. When you open the Azure SDK repo in VS Code, it will prompt you to open the project in the Dev Container. If it does not prompt you, then hit CTRL+P, and select "Remote-Containers: Open Folder in Container..."
1. Open a Terminal
1. Execute the following command and CTRL+Click the link generated. A new window will open with the Azure SDK website.
1. Press `Ctrl+Shift+T` or execute the following command and `Ctrl+Click` the link generated. A new window will open with the Azure SDK website.
```
```bash
bundle exec jekyll serve
```
Expand Down
3 changes: 0 additions & 3 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ output: web

plugins:
- jekyll-github-metadata
- jekyll-paginate
- jekyll-sitemap
- jekyll-gist
- jekyll-seo-tag
Expand Down Expand Up @@ -60,8 +59,6 @@ kramdown:
hard_wrap: false
syntax_highlighter: rouge

paginate: 10
paginate_path: /page:num/
timezone: "US/Pacific"

relative_links:
Expand Down

0 comments on commit 1f185ab

Please sign in to comment.