Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating a new Jekyll dev container leads to duplication in post create step #7948

Closed
tudortimi opened this issue Jan 29, 2023 · 3 comments
Closed
Assignees

Comments

@tudortimi
Copy link

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.73.1
  • OS Version: CentOS 7

Steps to Reproduce:

  1. Execute "Create Dev Container" command
  2. Select Jekyll

The command will create a devcontainer.json with the following content:

// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/jekyll
{
	"name": "Jekyll",
	// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
	"image": "mcr.microsoft.com/devcontainers/jekyll:0-bullseye",

	// Features to add to the dev container. More info: https://containers.dev/features.
	// "features": {},

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

	// Use 'postCreateCommand' to run commands after the container is created.
	"postCreateCommand": "sh .devcontainer/post-create.sh"

	// Configure tool-specific properties.
	// "customizations": {},

	// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
	// "remoteUser": "root"
}

and a post-create.sh:

#!/bin/sh

# Install the version of Bundler.
if [ -f Gemfile.lock ] && grep "BUNDLED WITH" Gemfile.lock > /dev/null; then
    cat Gemfile.lock | tail -n 2 | grep -C2 "BUNDLED WITH" | tail -n 1 | xargs gem install bundler -v
fi

# If there's a Gemfile, then run `bundle install`
# It's assumed that the Gemfile will install Jekyll too
if [ -f Gemfile ]; then
    bundle install
fi

Newer versions of the Jekyll dev container already contain the settings for postCreateCommand (and in port forwarding) - the entry in the JSON and the script. The generated setup results in the bundler commands being executed twice.

@tudortimi
Copy link
Author

Starting with version 0.1.9 of mcr.microsoft.com/devcontainers/jekyll, the dev container already contains the settings related to post-create.sh:

https://github.com/devcontainers/images/tree/v0.2.9/src/jekyll/.devcontainer

@tudortimi
Copy link
Author

Version 0.1.9 of Jekyll is part of version 0.2.9 of the entire repo: https://github.com/devcontainers/images/blob/main/src/jekyll/history/0.1.9.md

@chrmarti
Copy link
Contributor

chrmarti commented Feb 2, 2023

Continuing in devcontainers/templates#118. Thanks.

@chrmarti chrmarti closed this as completed Feb 2, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Mar 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants