Skip to content

Commit ab5914b

Browse files
authored
Merge pull request #38 from AkihiroSuda/dev
examples: move to https://github.com/AkihiroSuda/apt-transport-oci-examples
2 parents cf29cc8 + 5c5a72c commit ab5914b

6 files changed

Lines changed: 12 additions & 120 deletions

File tree

‎.github/workflows/main.yml‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@ jobs:
2626
- run: |
2727
sudo tee /etc/apt/sources.list.d/oci.sources <<EOF
2828
Types: deb
29-
URIs: oci://ghcr.io/akihirosuda/hello-apt-transport-oci:latest
29+
URIs: oci://ghcr.io/akihirosuda/apt-transport-oci-examples/hello-apt-transport-oci:latest
3030
Suites: stable
3131
Components: main
32-
Signed-By: /etc/apt/keyrings/AkihiroSuda.gpg
32+
Signed-By: /etc/apt/keyrings/apt-transport-oci-examples.gpg
3333
EOF
34-
- run: curl -fsSL https://github.com/AkihiroSuda.gpg | sudo gpg --dearmor -o /etc/apt/keyrings/AkihiroSuda.gpg
34+
- run: |
35+
curl -fsSL https://raw.githubusercontent.com/AkihiroSuda/apt-transport-oci-examples/refs/heads/master/apt-transport-oci-examples.gpg \
36+
| sudo gpg --dearmor -o /etc/apt/keyrings/apt-transport-oci-examples.gpg
3537
- run: sudo apt-get update
3638
- run: sudo apt-get install hello-apt-transport-oci
3739
- run: hello-apt-transport-oci

‎README.md‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,24 @@ sudo go build -o /usr/lib/apt/methods/oci ./cmd/usr-lib-apt-methods-oci
3030
</details>
3131

3232
## Example
33-
The following example installs the `hello-apt-transport-oci` package from the [`oci://ghcr.io/akihirosuda/hello-apt-transport-oci`](https://ghcr.io/akihirosuda/hello-apt-transport-oci) repo.
33+
The following example installs the `hello-apt-transport-oci` package from the [`oci://ghcr.io/akihirosuda/apt-transport-oci-examples/hello-apt-transport-oci`](https://ghcr.io/akihirosuda/apt-transport-oci-examples/hello-apt-transport-oci) image.
3434

3535
> [!TIP]
36-
> See [`./examples`](./examples) for how to build and push this package to your own registry.
36+
> See <https://github.com/AkihiroSuda/apt-transport-oci-examples> for how to build and push this package to your own registry.
3737
3838
- Create `/etc/apt/sources.list.d/oci.sources` with the following content:
3939
```
4040
Types: deb
41-
URIs: oci://ghcr.io/akihirosuda/hello-apt-transport-oci:latest
41+
URIs: oci://ghcr.io/akihirosuda/apt-transport-oci-examples/hello-apt-transport-oci:latest
4242
Suites: stable
4343
Components: main
44-
Signed-By: /etc/apt/keyrings/AkihiroSuda.gpg
44+
Signed-By: /etc/apt/keyrings/apt-transport-oci-examples.gpg
4545
```
4646

4747
- Register a GPG key:
4848
```bash
49-
curl -fsSL https://github.com/AkihiroSuda.gpg | sudo gpg --dearmor -o /etc/apt/keyrings/AkihiroSuda.gpg
49+
curl -fsSL https://raw.githubusercontent.com/AkihiroSuda/apt-transport-oci-examples/refs/heads/master/apt-transport-oci-examples.gpg \
50+
| sudo gpg --dearmor -o /etc/apt/keyrings/apt-transport-oci-examples.gpg
5051
```
5152

5253
- Run:

‎examples/.gitignore‎

Lines changed: 0 additions & 2 deletions
This file was deleted.

‎examples/README.md‎

Lines changed: 1 addition & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -1,103 +1 @@
1-
# Creating an apt repo on an OCI registry
2-
3-
## Step 1: Create dpkg
4-
Create `hello-apt-transport-oci_0.1_all.deb` from [`helloapt-transport-oci` directory](./hello-apt-transport-oci).
5-
6-
```bash
7-
dpkg-deb --build --root-owner-group hello-apt-transport-oci hello-apt-transport-oci_0.1_all.deb
8-
```
9-
10-
## Step 2: Create repository data
11-
12-
Use [aptly](https://www.aptly.info) to create the repository data.
13-
14-
```bash
15-
sudo apt-get install aptly
16-
```
17-
18-
```bash
19-
aptly repo create hello-apt-transport-oci
20-
aptly repo add hello-apt-transport-oci hello-apt-transport-oci_0.1_all.deb
21-
aptly publish repo -distribution=stable -architectures=all,amd64,arm64 hello-apt-transport-oci
22-
```
23-
24-
The repository data will be locally published on `~/.aptly/public`.
25-
26-
```console
27-
$ tree ~/.aptly/public
28-
/home/USER/.aptly/public
29-
├── dists
30-
│   └── stable
31-
│   ├── Contents-all.gz
32-
│   ├── Contents-amd64.gz
33-
│   ├── Contents-arm64.gz
34-
│   ├── InRelease
35-
│   ├── main
36-
│   │   ├── binary-all
37-
│   │   │   ├── Packages
38-
│   │   │   ├── Packages.bz2
39-
│   │   │   ├── Packages.gz
40-
│   │   │   └── Release
41-
│   │   ├── binary-amd64
42-
│   │   │   ├── Packages
43-
│   │   │   ├── Packages.bz2
44-
│   │   │   ├── Packages.gz
45-
│   │   │   └── Release
46-
│   │   ├── binary-arm64
47-
│   │   │   ├── Packages
48-
│   │   │   ├── Packages.bz2
49-
│   │   │   ├── Packages.gz
50-
│   │   │   └── Release
51-
│   │   ├── Contents-all.gz
52-
│   │   ├── Contents-amd64.gz
53-
│   │   └── Contents-arm64.gz
54-
│   ├── Release
55-
│   └── Release.gpg
56-
└── pool
57-
└── main
58-
└── h
59-
└── hello-apt-transport-oci
60-
└── hello-apt-transport-oci_0.1_all.deb
61-
62-
11 directories, 22 files
63-
```
64-
65-
## Step 3: Push to an OCI registry
66-
Push the deb file and the `Packages` file to an OCI registry (e.g., `ghcr.io`).
67-
68-
The easiest way is to use [ORAS](https://github.com/oras-project/oras) CLI.
69-
70-
```bash
71-
sudo apt-get install oras
72-
```
73-
74-
```bash
75-
echo YOUR_GITHUB_PERSONAL_ACCESS_TOKEN | docker login ghcr.io -u USERNAME --password-stdin
76-
```
77-
78-
```bash
79-
cd ~/.aptly/public
80-
find . -type f -printf "%p:application/octet-stream\n" | xargs oras push --image-spec=v1.0 ghcr.io/USERNAME/hello-apt-transport:latest
81-
```
82-
83-
- See [GHCR documentation](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry) to learn
84-
how to create a [GitHub Personal Access Token](https://github.com/settings/personal-access-tokens) (PAT) for `ghcr.io`.
85-
- Use GitHub Web UI to make the image public / private.
86-
87-
## Step 4: Tell users the instruction
88-
89-
Tell your users how to install your package:
90-
91-
> - Create `/etc/apt/sources.list.d/oci.sources` with the following content:
92-
> ```
93-
> Types: deb
94-
> URIs: oci://ghcr.io/USERNAME/hello-apt-transport-oci:latest
95-
> Suites: stable
96-
> Components: main
97-
> Signed-By: /etc/apt/keyrings/USERNAME.gpg
98-
> ```
99-
>
100-
> - Register a GPG key:
101-
> ```bash
102-
> curl -fsSL https://github.com/USERNAME.gpg | sudo gpg --dearmor -o /etc/apt/keyrings/USERNAME.gpg
103-
> ```
1+
Moved to <https://github.com/AkihiroSuda/apt-transport-oci-examples>.

‎examples/hello-apt-transport-oci/DEBIAN/control‎

Lines changed: 0 additions & 5 deletions
This file was deleted.

‎examples/hello-apt-transport-oci/usr/bin/hello-apt-transport-oci‎

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)