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
Basic devcontainer config #4845
Open
krissetto
wants to merge
1
commit into
docker:master
Choose a base branch
from
krissetto:devcontainers
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+81
−2
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
// README at: https://github.com/devcontainers/templates/tree/main/src/go | ||
{ | ||
"name": "cli - devcontainer", | ||
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile | ||
"image": "mcr.microsoft.com/devcontainers/go:1-1.21-bullseye", | ||
// Features to add to the dev container. More info: https://containers.dev/features. | ||
"features": { | ||
"ghcr.io/devcontainers/features/common-utils:2": { | ||
"installZsh": true, | ||
"configureZshAsDefaultShell": true, | ||
"installOhMyZsh": true, | ||
"installOhMyZshConfig": true, | ||
"upgradePackages": true, | ||
"username": "devcontainer", | ||
"userUid": "1001", | ||
"userGid": "1001" | ||
}, | ||
"ghcr.io/devcontainers/features/docker-in-docker:2": { | ||
"moby": true, | ||
"version": "latest", | ||
"dockerDashComposeVersion": "v2" | ||
}, | ||
"ghcr.io/devcontainers/features/git:1": { | ||
"ppa": true, | ||
"version": "latest" | ||
} | ||
}, | ||
// Use 'postStartCommand' to run commands after the container is started. | ||
"postStartCommand": "cd /workspaces/cli/ && ln -sf vendor.mod go.mod && ln -sf vendor.sum go.sum && go mod tidy", | ||
// Configure tool-specific properties. | ||
"customizations": { | ||
"vscode": { | ||
// Set *default* container specific settings.json values on container create. | ||
"settings": {}, | ||
"extensions": [ | ||
"bierner.markdown-mermaid" | ||
] | ||
} | ||
} | ||
} |
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
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 |
---|---|---|
|
@@ -7,12 +7,38 @@ start participating. | |
|
||
## Topics | ||
|
||
* [Development environment](#development-environment) | ||
* [Reporting Security Issues](#reporting-security-issues) | ||
* [Design and Cleanup Proposals](#design-and-cleanup-proposals) | ||
* [Reporting Issues](#reporting-other-issues) | ||
* [Quick Contribution Tips and Guidelines](#quick-contribution-tips-and-guidelines) | ||
* [Community Guidelines](#docker-community-guidelines) | ||
|
||
## Development environment | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another option is cloning the CLI repo inside your global mkdir -p $GOPATH/src/github.com/docker/
cd $GOPATH/src/github.com/docker
git clone git@github.com:docker/cli.git |
||
|
||
The only requirements for setting up a local development environment are: | ||
|
||
- [`go`](https://go.dev/dl/) -> latest version is fine, we use `//go:build go1.xx` directives in individual files to build those using a specific version of the go language/compiler; | ||
- [`docker`](https://www.docker.com) -> latest version is also fine; | ||
- `make` (on MacOS, install the developer command line tools with `xcode-select --install`) | ||
- IDE of your choice ([`VSCode`](https://code.visualstudio.com/download), [`Jetbrains GoLand`](https://www.jetbrains.com/go/), etc.) | ||
|
||
### Go modules | ||
|
||
Currently the project is not setup as a standard "go modules" project to avoid breaking dependant projects. To develop the project as if it were a go module project, you should symlink the `vendor.mod/sum` files to `go.mod/sum`, the following command should do the trick: | ||
|
||
`ln -s vendor.mod go.mod && ln -s vendor.sum go.sum` | ||
|
||
This step is unnecessary if using the devcontainers approach seen below, as it's already configured to create the symlinks for development. | ||
|
||
### Using a devcontainer | ||
|
||
This project also comes with an included `.devcontainer/` directory and a `devcontainer.json` file that can be used with `VSCode` or `GoLand` to quickly setup a development container, with all the basic required development dependencies already included. | ||
|
||
Using VSCode, all that's required is installing the [`Dev Containers` extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containersCheck), and it should auto-detect the `devcontainer.json` file and give you the option to start the container. | ||
|
||
For other IDEs, please check the relevant documentation of your editor for instructions on how to use devcontainers | ||
|
||
## Reporting security issues | ||
|
||
The Docker maintainers take security seriously. If you discover a security | ||
|
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JSON doesn't allow comments 🤔 should this have a
jsonc
file-extension ? (is that the official extension for it?)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, the official devcontainers spec defines the file as a JSON with Comments, but using the
.json
extension. I know.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😬 that feels very "YOLO - works for us, just not for everyone else"