Skip to content

Commit 73fd80d

Browse files
committed
update readme
1 parent e28e63f commit 73fd80d

File tree

3 files changed

+15
-102
lines changed

3 files changed

+15
-102
lines changed

README.md

Lines changed: 7 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,110 +1,23 @@
1-
# Dev Container Features: Self Authoring Template
1+
# My devcontainer features
22

3-
> This repo provides a starting point and example for creating your own custom [dev container Features](https://containers.dev/implementors/features/), hosted for free on GitHub Container Registry. The example in this repository follows the [dev container Feature distribution specification](https://containers.dev/implementors/features-distribution/).
4-
>
5-
> To provide feedback to the specification, please leave a comment [on spec issue #70](https://github.com/devcontainers/spec/issues/70). For more broad feedback regarding dev container Features, please see [spec issue #61](https://github.com/devcontainers/spec/issues/61).
6-
7-
## Example Contents
8-
9-
This repository contains a _collection_ of two Features - `hello` and `color`. These Features serve as simple feature implementations. Each sub-section below shows a sample `devcontainer.json` alongside example usage of the Feature.
103

11-
### `hello`
4+
## `magircmirror`
125

13-
Running `hello` inside the built container will print the greeting provided to it via its `greeting` option.
6+
Automatically setup package manager mirrors, including ubuntu, pypi and apk etc.
147

158
```jsonc
169
{
1710
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
1811
"features": {
19-
"ghcr.io/devcontainers/feature-starter/hello:1": {
20-
"greeting": "Hello"
21-
}
22-
}
23-
}
24-
```
25-
26-
```bash
27-
$ hello
28-
29-
Hello, user.
30-
```
31-
32-
### `color`
33-
34-
Running `color` inside the built container will print your favorite color to standard out.
35-
36-
```jsonc
37-
{
38-
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
39-
"features": {
40-
"ghcr.io/devcontainers/feature-starter/color:1": {
41-
"favorite": "green"
42-
}
43-
}
44-
}
45-
```
46-
47-
```bash
48-
$ color
49-
50-
my favorite color is green
51-
```
52-
53-
## Repo and Feature Structure
54-
55-
Similar to the [`devcontainers/features`](https://github.com/devcontainers/features) repo, this repository has a `src` folder. Each Feature has its own sub-folder, containing at least a `devcontainer-feature.json` and an entrypoint script `install.sh`.
56-
57-
```
58-
├── src
59-
│ ├── hello
60-
│ │ ├── devcontainer-feature.json
61-
│ │ └── install.sh
62-
│ ├── color
63-
│ │ ├── devcontainer-feature.json
64-
│ │ └── install.sh
65-
| ├── ...
66-
│ │ ├── devcontainer-feature.json
67-
│ │ └── install.sh
68-
...
69-
```
70-
71-
An [implementing tool](https://containers.dev/supporting#tools) will composite [the documented dev container properties](https://containers.dev/implementors/features/#devcontainer-feature-json-properties) from the feature's `devcontainer-feature.json` file, and execute in the `install.sh` entrypoint script in the container during build time. Implementing tools are also free to process attributes under the `customizations` property as desired.
72-
73-
### Options
74-
75-
All available options for a Feature should be declared in the `devcontainer-feature.json`. The syntax for the `options` property can be found in the [devcontainer Feature json properties reference](https://containers.dev/implementors/features/#devcontainer-feature-json-properties).
76-
77-
For example, the `color` feature provides an enum of three possible options (`red`, `gold`, `green`). If no option is provided in a user's `devcontainer.json`, the value is set to "red".
78-
79-
```jsonc
80-
{
81-
// ...
82-
"options": {
83-
"favorite": {
84-
"type": "string",
85-
"enum": [
86-
"red",
87-
"gold",
88-
"green"
89-
],
90-
"default": "red",
91-
"description": "Choose your favorite color."
12+
"ghcr.io/sidecus/devcontainer-features/magicmirror:1": {
13+
"pypi_mirror": "https://mirrors.bfsu.edu.cn/pypi/web/simple/",
14+
"ubuntu_mirror": "mirrors.bfsu.edu.cn",
15+
"apk_mirror": "mirrors.tuna.tsinghua.edu.cn"
9216
}
9317
}
9418
}
9519
```
9620

97-
Options are exported as Feature-scoped environment variables. The option name is captialized and sanitized according to [option resolution](https://containers.dev/implementors/features/#option-resolution).
98-
99-
```bash
100-
#!/bin/bash
101-
102-
echo "Activating feature 'color'"
103-
echo "The provided favorite color is: ${FAVORITE}"
104-
105-
...
106-
```
107-
10821
## Distributing Features
10922

11023
### Versioning

src/magicmirror/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11

2-
# Mirror
2+
# Automated devcontainer mirror setup (magicmirror)
33

4-
A hello world feature
4+
A devcontainer feature that setups mirrors for package managers automatically
55

66
## Example Usage
77

88
```json
99
"features": {
10-
"ghcr.io/devcontainers/feature-starter/hello:1": {
11-
"version": "latest"
12-
}
10+
"ghcr.io/sidecus/devcontainer-features/magicmirror:1": {}
1311
}
1412
```
1513

1614
## Options
1715

1816
| Options Id | Description | Type | Default Value |
1917
|-----|-----|-----|-----|
20-
| greeting | Select a pre-made greeting, or enter your own | string | hey |
18+
| pypi_mirror | Pypi mirror url | string | - |
19+
| ubuntu_mirror | Ubuntu mirror | string | - |
20+
| apk_mirror | Ubuntu mirror | string | - |
2121

2222

2323

2424
---
2525

26-
_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/devcontainers/feature-starter/blob/main/src/hello/devcontainer-feature.json). Add additional notes to a `NOTES.md`._
26+
_Note: This file was auto-generated from the [devcontainer-feature.json](devcontainer-feature.json). Add additional notes to a `NOTES.md`._

src/magicmirror/devcontainer-feature.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "Automated devcontainer mirror setup",
33
"id": "magicmirror",
4-
"version": "0.0.9",
4+
"version": "1.0.0",
55
"description": "A devcontainer feature that setups mirrors for package managers automatically",
66
"options": {
77
"pypi_mirror": {

0 commit comments

Comments
 (0)