Skip to content

Commit

Permalink
docs(dev): improve devcontainer readme
Browse files Browse the repository at this point in the history
  • Loading branch information
qdm12 committed Oct 20, 2024
1 parent 15f6b13 commit 6ace314
Showing 1 changed file with 11 additions and 19 deletions.
30 changes: 11 additions & 19 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,51 +2,43 @@

Development container that can be used with VSCode.

It works on Linux, Windows and OSX.
It works on Linux, Windows (WSL2) and OSX.

## Requirements

- [VS code](https://code.visualstudio.com/download) installed
- [VS code dev containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) installed
- [Docker](https://www.docker.com/products/docker-desktop) installed and running
- [Docker Compose](https://docs.docker.com/compose/install/) installed

## Setup

1. Create the following files and directory on your host if you don't have them:

```sh
touch ~/.gitconfig ~/.zsh_history
mkdir -p ~/.ssh
```

1. **For Docker on OSX**: ensure the project directory and your home directory `~` are accessible by Docker.
1. **For OSX hosts**: ensure your home directory `~` is accessible by Docker.
1. Open the command palette in Visual Studio Code (CTRL+SHIFT+P).
1. Select `Dev Containers: Open Folder in Container...` and choose the project directory.
1. Select `Dev-Containers: Open Folder in Container...` and choose the project directory.

## Customizations
## Customization

For customizations to take effect, you should "rebuild and reopen":
For any customization to take effect, you should "rebuild and reopen":

1. Open the command palette in Visual Studio Code (CTRL+SHIFT+P)
2. Select `Dev Containers: Rebuild Container`
2. Select `Dev-Containers: Rebuild Container`

Customizations available are notably:

- Extend the Docker image in [Dockerfile](Dockerfile). For example add curl to it:

```Dockerfile
FROM qmcgaw/godevcontainer
RUN apk add curl
```
Changes you can make are notably:

- Changes to the Docker image in [Dockerfile](Dockerfile)
- Changes to VSCode **settings** and **extensions** in [devcontainer.json](devcontainer.json).
- Change the entrypoint script by adding a bind mount in [devcontainer.json](devcontainer.json) of a shell script to `/root/.welcome.sh` to replace the [current welcome script](https://github.com/qdm12/godevcontainer/blob/master/shell/.welcome.sh). For example:
- Change the entrypoint script by adding in [devcontainer.json](devcontainer.json) a bind mount to a shell script to `/root/.welcome.sh` to replace the [current welcome script](https://github.com/qdm12/godevcontainer/blob/master/shell/.welcome.sh). For example:

```json
// Welcome script
{
"source": "./.welcome.sh",
"source": "/yourpath/.welcome.sh",
"target": "/root/.welcome.sh",
"type": "bind"
},
Expand All @@ -63,4 +55,4 @@ Customizations available are notably:
POSTGRES_PASSWORD: password
```

- More customizations available are documented in the [devcontainer.json reference](https://containers.dev/implementors/json_reference/).
- More options are documented in the [devcontainer.json reference](https://containers.dev/implementors/json_reference/).

0 comments on commit 6ace314

Please sign in to comment.