code.gitea.io/gitea@v1.22.3/docs/content/usage/packages/alpine.en-us.md (about)

     1  ---
     2  date: "2023-03-25T00:00:00+00:00"
     3  title: "Alpine Package Registry"
     4  slug: "alpine"
     5  draft: false
     6  toc: false
     7  menu:
     8    sidebar:
     9      parent: "packages"
    10      name: "Alpine"
    11      sidebar_position: 4
    12      identifier: "alpine"
    13  ---
    14  
    15  # Alpine Package Registry
    16  
    17  Publish [Alpine](https://pkgs.alpinelinux.org/) packages for your user or organization.
    18  
    19  ## Requirements
    20  
    21  To work with the Alpine registry, you need to use a HTTP client like `curl` to upload and a package manager like `apk` to consume packages.
    22  
    23  The following examples use `apk`.
    24  
    25  ## Configuring the package registry
    26  
    27  To register the Alpine registry add the url to the list of known apk sources (`/etc/apk/repositories`):
    28  
    29  ```
    30  https://gitea.example.com/api/packages/{owner}/alpine/<branch>/<repository>
    31  ```
    32  
    33  | Placeholder  | Description |
    34  | ------------ | ----------- |
    35  | `owner`      | The owner of the packages. |
    36  | `branch`     | The branch to use. |
    37  | `repository` | The repository to use. |
    38  
    39  If the registry is private, provide credentials in the url. You can use a password or a [personal access token](development/api-usage.md#authentication):
    40  
    41  ```
    42  https://{username}:{your_password_or_token}@gitea.example.com/api/packages/{owner}/alpine/<branch>/<repository>
    43  ```
    44  
    45  The Alpine registry files are signed with a RSA key which must be known to apk. Download the public key and store it in `/etc/apk/keys/`:
    46  
    47  ```shell
    48  curl -JO https://gitea.example.com/api/packages/{owner}/alpine/key
    49  ```
    50  
    51  Afterwards update the local package index:
    52  
    53  ```shell
    54  apk update
    55  ```
    56  
    57  ## Publish a package
    58  
    59  To publish an Alpine package (`*.apk`), perform a HTTP `PUT` operation with the package content in the request body.
    60  
    61  ```
    62  PUT https://gitea.example.com/api/packages/{owner}/alpine/{branch}/{repository}
    63  ```
    64  
    65  | Parameter    | Description |
    66  | ------------ | ----------- |
    67  | `owner`      | The owner of the package. |
    68  | `branch`     | The branch may match the release version of the OS, ex: `v3.17`. |
    69  | `repository` | The repository can be used [to group packages](https://wiki.alpinelinux.org/wiki/Repositories) or just `main` or similar. |
    70  
    71  Example request using HTTP Basic authentication:
    72  
    73  ```shell
    74  curl --user your_username:your_password_or_token \
    75       --upload-file path/to/file.apk \
    76       https://gitea.example.com/api/packages/testuser/alpine/v3.17/main
    77  ```
    78  
    79  If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password.
    80  
    81  You cannot publish a file with the same name twice to a package. You must delete the existing package file first.
    82  
    83  The server responds with the following HTTP Status codes.
    84  
    85  | HTTP Status Code  | Meaning |
    86  | ----------------- | ------- |
    87  | `201 Created`     | The package has been published. |
    88  | `400 Bad Request` | The package name, version, branch, repository or architecture are invalid. |
    89  | `409 Conflict`    | A package file with the same combination of parameters exist already in the package. |
    90  
    91  ## Delete a package
    92  
    93  To delete an Alpine package perform a HTTP `DELETE` operation. This will delete the package version too if there is no file left.
    94  
    95  ```
    96  DELETE https://gitea.example.com/api/packages/{owner}/alpine/{branch}/{repository}/{architecture}/{filename}
    97  ```
    98  
    99  | Parameter      | Description |
   100  | -------------- | ----------- |
   101  | `owner`        | The owner of the package. |
   102  | `branch`       | The branch to use. |
   103  | `repository`   | The repository to use. |
   104  | `architecture` | The package architecture. |
   105  | `filename`     | The file to delete. |
   106  
   107  Example request using HTTP Basic authentication:
   108  
   109  ```shell
   110  curl --user your_username:your_token_or_password -X DELETE \
   111       https://gitea.example.com/api/packages/testuser/alpine/v3.17/main/test-package-1.0.0.apk
   112  ```
   113  
   114  The server responds with the following HTTP Status codes.
   115  
   116  | HTTP Status Code  | Meaning |
   117  | ----------------- | ------- |
   118  | `204 No Content`  | Success |
   119  | `404 Not Found`   | The package or file was not found. |
   120  
   121  ## Install a package
   122  
   123  To install a package from the Alpine registry, execute the following commands:
   124  
   125  ```shell
   126  # use latest version
   127  apk add {package_name}
   128  # use specific version
   129  apk add {package_name}={package_version}
   130  ```