Skip to content
This repository has been archived by the owner on Nov 30, 2023. It is now read-only.

Onboard Jekyll to image build #929

Merged
merged 8 commits into from
Jul 12, 2021
Merged

Onboard Jekyll to image build #929

merged 8 commits into from
Jul 12, 2021

Conversation

Chuxel
Copy link
Member

@Chuxel Chuxel commented Jul 1, 2021

This implements #919 to generate a jekyll image. Like other images, it will include nvm and yarn, but does not include a specific version of Node.js in base.Dockerfile. Instead this is added in the user Dockerfile based on a version in devcontainer.json. The user will be prompted for which version when this definition is added via Add Development Configuration Files. Unneeded files (like base.Dockerfile) are also filtered out in this case.

To test the image alone:

  1. Open this repository in a Codespace
  2. Run the following in a terminal in the repository root
    yarn install
    build/vscdc push --no-push --registry mcr.microsoft.com --registry-path vscode/devcontainers --release main jekyll
    docker run -it -u vscode --rm mcr.microsoft.com/vscode/devcontainers/jekyll:dev bash
  3. Once in the container, run nvm install lts/* to ensure node installs
  4. Do any verification you want to do.

Once merged, mcr.microsoft.com/vscode/devcontainers/jekyll:dev will be published, and on release the inital version of the image will go (currently set to 0.0.1).

@Chuxel
Copy link
Member Author

Chuxel commented Jul 1, 2021

//cc: @cmendible @parkr for a review. @2percentsilk, @joshspicer, @bailey, @matthewisabel as FYI.

@Chuxel Chuxel mentioned this pull request Jul 1, 2021
Comment on lines +536 to +548
// If image not yet published, there will be no repo digests, so set to N/A if that is the case
let name, digest;
try {
const imageNameAndDigest = await asyncUtils.spawn('docker', ['inspect', "--format='{{index .RepoDigests 0}}'", image], { shell: true, stdio: 'pipe' });
[name, digest] = imageNameAndDigest.trim().split('@');
} catch(err) {
if(err.result.indexOf('Template parsing error') > 0) {
name = 'N/A';
digest = 'N/A';
} else {
throw err;
}
}
Copy link
Member Author

@Chuxel Chuxel Jul 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI - This is a bug I ran into while testing history markdown generation locally (didn't happen if image already was published which is the situation normally when this is run).

To see what ends up in history, run:

build/vscdc info --registry mcr.microsoft.com --registry-path vscode/devcontainers --release main jekyll

The result will be in containers/jekyll/history/dev.md

Otherwise unrelated.

Copy link
Contributor

@parkr parkr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me – left a few comments. Thank you!

# && apt-get -y install --no-install-recommends <your-package-list-here>

# [Optional] Uncomment this line to install additional gems.
# RUN gem install <your-gem-names-here>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, we recommend folks add gems to their Gemfile and use bundle install to manage them.


- `mcr.microsoft.com/vscode/devcontainers/jekyll:0`
- `mcr.microsoft.com/vscode/devcontainers/jekyll:0.0`
- `mcr.microsoft.com/vscode/devcontainers/jekyll:0.0.1`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you intend to version the Jekyll container? Since it's not presently tied to a Jekyll or GitHub Pages version, and because the post-install script will still run bundle install, it may not need to be versioned at all.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this versioning is for the image contents. But if we don't have a reason to release, we wouldn't bump the version number up.

At a minimum, there's monthly OS patching, so we'd update roughly once a month and that would get the latest of everything. That just increments the last digit (since we use semver). We do the same thing for all images in the repo. This is explained here.

The other thing this does is future proof for when/if we need to make breaking changes.

containers/jekyll/README.md Outdated Show resolved Hide resolved
containers/jekyll/README.md Outdated Show resolved Hide resolved
LANGUAGE=en_US

# Install bundler, latest jekyll, and github-pages for older jekyll
RUN gem install bundler jekyll github-pages
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to work, installing both Jekyll 3 and Jekyll 4 as desired to speed up the bundle install process.

@Chuxel Chuxel merged commit 5906980 into main Jul 12, 2021
@Chuxel Chuxel deleted the clantz/jekyll-onboard branch August 31, 2021 23:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants