Skip to content

Commit

Permalink
define user ownership to workspace directory in devcontainer.json
Browse files Browse the repository at this point in the history
Signed-off-by: Jeffrey <jeffwhewhetu@gmail.com>
c0d33ngr committed Jan 29, 2025
1 parent f42afac commit 63a6b75
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -135,6 +135,10 @@ it, and then save it.
"ghcr.io/itsmechlark/features/postgresql:1": {
"version": "latest"
}
},
"onCreateCommand": {
"update": "sudo apt update && sudo apt upgrade -y",
"ownership": "sudo chown -R $USER:$USER ${containerWorkspaceFolder}"
}
}
```
@@ -146,6 +150,7 @@ development container environment.
`PostgreSQL Dev Container Playground`.
- **`image`:** This uses a base Ubuntu image from Microsoft image repository.
- **`features`:** This configuration adds PostgreSQL setup in the environment.
- **onCreateCommand:** This section update and upgrade the system packages in the environment and also give the `$USER` ownership to the workspace directory.

Your directory structure should look like mine below if you follow along using
the same directory name as I did earlier.
Original file line number Diff line number Diff line change
@@ -104,6 +104,10 @@ Paste this code into your `devcontainer.json` file.
"ghcr.io/eitsupi/devcontainer-features/duckdb-cli:1": {},
"ghcr.io/devcontainers/features/python:1": {}
},
"onCreateCommand": {
"update": "sudo apt update && sudo apt upgrade -y",
"ownership": "sudo chown -R $USER:$USER ${containerWorkspaceFolder}"
},
"postCreateCommand": "pip install duckdb matplotlib pandas"
}
```
@@ -113,6 +117,7 @@ The `devcontainer.json` content contains configurations to start your DuckDB env
- `name`: This sets the name of the development container environment to `DuckDB Playground`.
- `image`: This uses a base Ubuntu image from the Microsoft image repository.
- `features`: This configuration adds DuckDB installation and Python setups in the Daytona workspace
- `onCreateCommand`: This sectiion update and upgrade the system packages in the environment and also give the `$USER` ownership to the workspace directory.
- `postCreateComand`: This installs the Python packages needed for this guide into the workspace.

After creating and saving the `devcontainer.json` file, move up back to the root directory of your clone [repository](/definitions/20240819_definition_repository.md). For me, I run the command below.

0 comments on commit 63a6b75

Please sign in to comment.