This repository is an example of creating .rpm
, .deb
and .apk
packages for Golang applications.
Install Golang
See https://go.dev/doc/install
Setup fpm with yum
yum update -y && yum install -y make rpm-build rubygems
gem install fpm
Setup fpm with apt
apt update && apt install -y make ruby build-essential
gem install fpm
Setup fpm with apk
apk update && apk add make rpm ruby tar
gem install fpm
CGO_ENABLED=0 go build -ldflags="-w -s" ./hello.go
Default version and arch are defined in ./Makefile. Overwrite them if necessary.
Packages are output in ./packages/
directory by default.
.rpm using fpm
make fpm-rpm
.deb using fpm
make fpm-deb
.apk using fpm
make fpm-apk
apt
# Install
apt install ./hello-0.0.0-1.x86_64.deb
# Remove
apt remove --purge hello
rpm
# Install
rpm --nodeps -ivh ./hello-0.0.0-1.x86_64.rpm
# Remove
rpm -e hello-0.0.0-1.x86_64
yum
# Install
yum install ./hello-0.0.0-1.x86_64.rpm
# Remove
yum remove -y hello
apk
# Install
apk add --allow-untrusted hello-0.0.0-1.x86_64.apk
# Remove
apk del hello