实际上melange是apko 的相关项目,结合起来可以更好的创建基于apk 的oci 镜像,melange 主要是定义了
一套pipeline 可以方便的进行apk 包开发
安装
可以基于docker 运行
go install chainguard.dev/melange@latest
使用
- 配置
package:
name: hello
version: 2.12
epoch: 0
description: "the GNU hello world program"
target-architecture:
- amd64
copyright:
- paths:
- "*"
attestation: |
Copyright 1992, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2005,
2006, 2007, 2008, 2010, 2011, 2013, 2014, 2022 Free Software Foundation,
Inc.
license: GPL-3.0-or-later
dependencies:
runtime:
environment:
contents:
repositories:
- https://mirrors.aliyun.com/alpine/edge/main
packages:
- alpine-baselayout-data
- busybox
- build-base
- scanelf
- ssl_client
- ca-certificates-bundle
pipeline:
- uses: fetch
with:
uri: https://ftp.gnu.org/gnu/hello/hello-${{package.version}}.tar.gz
expected-sha256: cf04af86dc085268c5f4470fbae49b18afbc221b78096aab842d934a76bad0ab
- uses: autoconf/configure
- uses: autoconf/make
- uses: autoconf/make-install
- uses: strip
- 构建
可以直接基于docker 运行比较方便
docker run --rm --privileged -v "${PWD}":/work \
cgr.dev/chainguard/melange build demo.yaml \
--arch amd64
效果
说明
使用melange 构建apk 包是一个听不错的选择,比较方便
参考资料
https://github.com/chainguard-dev/melange
https://github.com/chainguard-dev/apko
https://github.com/chainguard-dev/melange/blob/main/docs/PIPELINES-GO.md