Alpine Repository

Alpine Linux is a lightweight Linux Distribution that is designed to be smaller and more resource efficient, and as such has grown popular as the basis for Docker containers.

For more information on Alpine, please see:

Contextual Documentation

The examples in this document are generic. Cloudsmith provides contextual setup instructions within each repository, complete with copy and paste snippets (with your namespace/repo/rsa-key pre-configured).

In the following examples:

IdentifierDescription
OWNERYour Cloudsmith account name or organization name (namespace)
REPOSITORYYour Cloudsmith Repository name (also called "slug")
VERSIONAlpine distribution version, i.e. v3.8. You can also use "any-version" if your package is compatible with more than one version
FINGERPRINTthe 8 Byte fingerprint of the Public RSA key for the repository
TOKENYour Cloudsmith Entitlement Token (see Entitlements for more details)
USERNAMEYour Cloudsmith username
PASSWORDYour Cloudsmith password
API-KEYYour Cloudsmith API Key
PACKAGE_NAMEThe name of your package
PACKAGE_VERSIONThe version number of your package

Upload a Package

Upload via the Cloudsmith CLI

For full details of how to install and setup the Cloudsmith CLI, see Command Line Interface.

The command to upload an Alpine package via the Cloudsmith CLI is:

shell
cloudsmith push alpine OWNER/REPOSITORY/alpine/VERSION PACKAGE_NAME-PACKAGE_VERSION.apk

Example: Upload a package for Alpine v3.8

shell
cloudsmith push alpine org/repo/alpine/v3.8 libjq-1.0.3.apk

Example: Upload a package for any version of Alpine

shell
cloudsmith push alpine org/repo/alpine/any-version libjq-1.0.3.apk

Upload via Cloudsmith Website

Please see Upload a Package for details of how to upload via the Cloudsmith web app.

Download / Install a Package

You have a choice of 3 methods to setup your Cloudsmith repository:

  • Automatic configuration (recommended)
  • Force a specific distribution/release (if your system is compatible but not identical)
  • Manual configuration

Public Repositories

To install Alpine packages from a public Cloudsmith repository , you can quickly set up the repository automatically:

shell
sudo apk add --no-cache bash
curl -1sLf \
  'https://dl.cloudsmith.io/public/OWNER/REPOSITORY/cfg/setup/bash.alpine.sh' \
  | sudo bash

If you need to force a specific distribution:

shell
sudo apk add --no-cache bash
curl -1sLf \
  'https://dl.cloudsmith.io/public/OWNER/REPOSITORY/cfg/setup/bash.alpine.sh' \
  | sudo distro=alpine codename=VERSION bash

Or, you can manually configure the repository

shell
curl -1sLf 'https://dl.cloudsmith.io/public/OWNER/REPOSITORY/cfg/rsa/rsa.FINGERPRINT.key' > /etc/apk/keys/REPOSITORY@OWNER-FINGERPRINT.rsa.pub
curl -1sLf 'https://dl.cloudsmith.io/public/OWNER/REPOSITORY/cfg/setup/config.alpine.txt?distro=alpine&codename=VERSION' >> /etc/apk/repositories
apk update

Private Repositories

Private Repositories

Private Cloudsmith repositories require authentication. You can choose between two types of authentication, Entitlement Token Authentication or HTTP Basic Authentication. The setup method will differ depending on what authentication type you choose to use.

Warning

Entitlement Tokens, User Credentials and API-Keys should be treated as secrets, and you should ensure that you do not commit them in configurations files along with source code, or expose them in any logs.

To install Alpine packages from a private Cloudsmith repository, you can quickly set up the repository automatically:

shell
curl -1sLf 'https://dl.cloudsmith.io/TOKEN/OWNER/REPOSITORY/cfg/setup/bash.alpine.sh' \
| sudo bash
shell
sudo apk add --no-cache bash
curl -u "USERNAME:PASSWORD" -1sLf \
  'https://dl.cloudsmith.io/basic/OWNER/REPOSITORY/cfg/setup/bash.alpine.sh' \
  | sudo bash
shell
sudo apk add --no-cache bash
curl -u "USERNAME:API-KEY" -1sLf \
  'https://dl.cloudsmith.io/basic/OWNER/REPOSITORY/cfg/setup/bash.alpine.sh' \
  | sudo bash
shell
sudo apk add --no-cache bash
curl -u "token:TOKEN" -1sLf \
  'https://dl.cloudsmith.io/basic/OWNER/REPOSITORY/cfg/setup/bash.alpine.sh' \
  | sudo bash

If you need to force a specific distribution:

shell
sudo apk add --no-cache bash
curl -1sLf 'https://dl.cloudsmith.io/TOKEN/OWNER/REPOSITORY/cfg/setup/bash.alpine.sh' \
| sudo distro=alpine codename=VERSION bash
shell
sudo apk add --no-cache bash
curl -u "USERNAME:PASSWORD" -1sLf \
  'https://dl.cloudsmith.io/basic/OWNER/REPOSITORY/cfg/setup/bash.alpine.sh' \
  | sudo distro=alpine codename=VERSION bash
shell
sudo apk add --no-cache bash
curl -u "USERNAME:API-KEY" -1sLf \
  'https://dl.cloudsmith.io/basic/OWNER/REPOSITORY/cfg/setup/bash.alpine.sh' \
  | sudo distro=alpine codename=VERSION bash
shell
sudo apk add --no-cache bash
curl -u "token:TOKEN" -1sLf \
  'https://dl.cloudsmith.io/basic/OWNER/REPOSITORY/cfg/setup/bash.alpine.sh' \
  | sudo distro=alpine codename=VERSION bash

Or, you can manually configure the repository:

shell
curl -1sLf 'https://dl.cloudsmith.io/TOKEN/OWNER/REPOSITORY/cfg/rsa/rsa.FINGERPRINT.key' > /etc/apk/keys/REPOSITORY@OWNER-FINGERPRINT.rsa.pub
curl -1sLf 'https://dl.cloudsmith.io/TOKEN/OWNER/REPOSITORY/cfg/setup/config.alpine.txt?distro=alpine&codename=VERSION' >> /etc/apk/repositories
apk update
shell
curl -u "USERNAME:PASSWORD" -1sLf 'https://dl.cloudsmith.io/basic/OWNER/REPOSITORY/cfg/rsa/rsa.FINGERPRINT.key' > /etc/apk/keys/REPOSITORY@OWNER-FINGERPRINT.rsa.pub
curl -u "USERNAME:PASSWORD" -1sLf 'https://dl.cloudsmith.io/basic/OWNER/REPOSITORY/cfg/setup/config.alpine.txt?distro=alpine&codename=VERSION' >> /etc/apk/repositories
apk update
shell
curl -u "USERNAME:API-KEY" -1sLf 'https://dl.cloudsmith.io/basic/OWNER/REPOSITORY/cfg/rsa/rsa.FINGERPRINT.key' > /etc/apk/keys/REPOSITORY@OWNER-FINGERPRINT.rsa.pub
curl -u "USERNAME:API-KEY" -1sLf 'https://dl.cloudsmith.io/basic/OWNER/REPOSITORY/cfg/setup/config.alpine.txt?distro=alpine&codename=VERSION' >> /etc/apk/repositories
apk update
shell
curl -u "token:TOKEN" -1sLf 'https://dl.cloudsmith.io/basic/OWNER/REPOSITORY/cfg/rsa/rsa.FINGERPRINT.key' > /etc/apk/keys/REPOSITORY@OWNER-FINGERPRINT.rsa.pub
curl -u "token:TOKEN" -1sLf 'https://dl.cloudsmith.io/basic/OWNER/REPOSITORY/cfg/setup/config.alpine.txt?distro=alpine&codename=VERSION' >> /etc/apk/repositories
apk update

Installing a package

After you have set up the repository, to install a package you do:

shell
sudo apk add PACKAGE_NAME=PACKAGE_VERSION --update-cache

Removing Setup

If you no longer want to install packages from your Cloudsmith repository, you can remove it with:

shell
$EDITOR /etc/apk/repositories

Remove the /alpine/VERSION/main line, save then execute:

shell
rm -f /etc/apk/keys/REPOSITORY@cloudsmith-FINGERPRINT.rsa.pub
apk update

Upstream Proxying / Caching

Not Supported

Key Signing Support

RSA Index

Troubleshooting

Please see the Troubleshooting page for further help and information.