-
Notifications
You must be signed in to change notification settings - Fork 13
Copy original devcontainer from https://github.com/microsoft/vscode-dev-containers #1
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -1,2 +1,65 @@ | ||
| # vscode-swift-devcontainer | ||
| Visual Studio Code Development Container for Swift | ||
| # Swift (Community) | ||
|
|
||
| ## Summary | ||
|
|
||
| *Develop Swift based applications. Includes everything you need to get up and running.* | ||
|
|
||
| | Metadata | Value | | ||
| |----------|-------| | ||
| | *Contributors* | [0xTim](https://github.com/0xTim), [adam-fowler](https://github.com/adam-fowler), [cloudnull](https://github.com/cloudnull) | | ||
| | *Categories* | Community, Languages | | ||
| | *Definition type* | Dockerfile | | ||
| | *Supported architecture(s)* | x86-64 | | ||
| | *Works in Codespaces* | Yes | | ||
| | *Container host OS support* | Linux, macOS, Windows | | ||
| | *Container OS* | Debian | | ||
| | *Languages, platforms* | Swift | | ||
|
|
||
| ## Using this definition | ||
|
|
||
| While the definition itself works unmodified, you can select the version of Swift the container uses by updating the `VARIANT` arg in the included `devcontainer.json` (and rebuilding if you've already created the container). | ||
|
|
||
| ```json | ||
| "args": { "VARIANT": "4" } | ||
| ``` | ||
|
|
||
| Given how frequently web applications use Node.js for front end code, this container also includes an optional install of Node.js. You can enable installation and change the version of Node.js installed or disable its installation by updating the `args` property in `.devcontainer/devcontainer.json`. | ||
|
|
||
| ```jsonc | ||
| "args": { | ||
| "VARIANT": "4", | ||
| "NODE_VERSION": "14" // Set to "none" to skip Node.js installation | ||
| } | ||
| ``` | ||
|
|
||
| ### Adding the definition to a project or codespace | ||
|
|
||
| 1. If this is your first time using a development container, please see getting started information on [setting up](https://aka.ms/vscode-remote/containers/getting-started) Remote-Containers or [creating a codespace](https://aka.ms/ghcs-open-codespace) using GitHub Codespaces. | ||
|
|
||
| 2. Start VS Code and open your project folder or connect to a codespace. | ||
|
|
||
| 3. Press <kbd>F1</kbd> select and **Add Development Container Configuration Files...** command for **Remote-Containers** or **Codespaces**. | ||
|
|
||
| > **Note:** If needed, you can drag-and-drop the `.devcontainer` folder from this sub-folder in a locally cloned copy of this repository into the VS Code file explorer instead of using the command. | ||
| 4. Select this definition. You may also need to select **Show All Definitions...** for it to appear. | ||
|
|
||
| 5. Finally, press <kbd>F1</kbd> and run **Remote-Containers: Reopen Folder in Container** or **Codespaces: Rebuild Container** to start using the definition. | ||
|
|
||
| ## Testing the definition | ||
|
|
||
| This definition includes some test code that will help you verify it is working as expected on your system. Follow these steps: | ||
|
|
||
| 1. If this is your first time using a development container, please follow the [getting started steps](https://aka.ms/vscode-remote/containers/getting-started) to set up your machine. | ||
| 2. Clone this repository. | ||
| 3. Start VS Code, press <kbd>F1</kbd>, and select **Remote-Containers: Open Folder in Container...** | ||
| 4. Select the `containers/swift` folder. | ||
| 5. After the folder has opened in the container, press <kbd>F5</kbd> to start the project. | ||
| 6. You should see "Hello, remote world!" in the Debug Console after the program executes. | ||
| 7. From here, you can add breakpoints or edit the contents of the `test-project` folder to do further testing. | ||
|
|
||
| ## License | ||
|
|
||
| Copyright (c) Microsoft Corporation. All rights reserved. | ||
|
|
||
| Licensed under the MIT License. See [LICENSE](https://github.com/microsoft/vscode-dev-containers/blob/main/LICENSE). | ||
This file contains hidden or 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,33 @@ | ||
| # [Choice] Swift version: 5.5, 5.4, 5.3, 5.2, 5.1, 4.2 | ||
| ARG VARIANT=5.5 | ||
| FROM swift:${VARIANT} | ||
|
|
||
| # [Option] Install zsh | ||
| ARG INSTALL_ZSH="true" | ||
| # [Option] Upgrade OS packages to their latest versions | ||
| ARG UPGRADE_PACKAGES="false" | ||
|
|
||
| # Install needed packages and setup non-root user. Use a separate RUN statement to add your own dependencies. | ||
| ARG USERNAME=vscode | ||
| ARG USER_UID=1000 | ||
| ARG USER_GID=$USER_UID | ||
| COPY library-scripts/common-debian.sh /tmp/library-scripts/ | ||
| RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ | ||
| && /bin/bash /tmp/library-scripts/common-debian.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" "true" "true" \ | ||
| && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* && rm -rf /tmp/library-scripts | ||
|
|
||
| # [Choice] Node.js version: none, lts/*, 16, 14, 12, 10 | ||
| ARG NODE_VERSION="none" | ||
| ENV NVM_DIR=/usr/local/share/nvm | ||
| ENV NVM_SYMLINK_CURRENT=true \ | ||
| PATH=${NVM_DIR}/current/bin:${PATH} | ||
| COPY library-scripts/node-debian.sh /tmp/library-scripts/ | ||
| RUN bash /tmp/library-scripts/node-debian.sh "${NVM_DIR}" "${NODE_VERSION}" "${USERNAME}" \ | ||
| && rm -rf /var/lib/apt/lists/* /tmp/library-scripts | ||
|
|
||
| # [Optional] Uncomment this section to install additional OS packages you may want. | ||
| # RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ | ||
| # && apt-get -y install --no-install-recommends <your-package-list-here> | ||
|
|
||
| # [Optional] Uncomment this line to install global node packages. | ||
| # RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1 |
This file contains hidden or 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,36 @@ | ||
| { | ||
| "name": "Swift (Community)", | ||
| "build": { | ||
| "dockerfile": "Dockerfile", | ||
| "args": { | ||
| // Update the VARIANT arg to pick a Swift version | ||
| "VARIANT": "5.7", | ||
| // Options | ||
| "NODE_VERSION": "lts/*" | ||
| } | ||
| }, | ||
| "runArgs": [ | ||
| "--cap-add=SYS_PTRACE", | ||
| "--security-opt", | ||
| "seccomp=unconfined" | ||
| ], | ||
|
|
||
| // Set *default* container specific settings.json values on container create. | ||
| "settings": { | ||
| "lldb.library": "/usr/lib/liblldb.so" | ||
| }, | ||
|
|
||
| // Add the IDs of extensions you want installed when the container is created. | ||
| "extensions": [ | ||
| "sswg.swift-lang" | ||
| ], | ||
|
|
||
| // Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
| // "forwardPorts": [], | ||
|
|
||
| // Use 'postCreateCommand' to run commands after the container is created. | ||
| // "postCreateCommand": "", | ||
|
|
||
| // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. | ||
| "remoteUser": "vscode" | ||
| } |
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.
Do we want to relicense this under the SSWG org?
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.
Yeah was going to do that in another PR. We don't have a group to assign the copyright to though. vscode-swift is copyright of the authors of vscode-swift.