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 fpmSetup fpm with apt
apt update && apt install -y make ruby build-essential
gem install fpmSetup fpm with apk
apk update && apk add make rpm ruby tar
gem install fpmCGO_ENABLED=0 go build -ldflags="-w -s" ./hello.goDefault 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-apkapt
# Install
apt install ./hello-0.0.0-1.x86_64.deb
# Remove
apt remove --purge hellorpm
# Install
rpm --nodeps -ivh ./hello-0.0.0-1.x86_64.rpm
# Remove
rpm -e hello-0.0.0-1.x86_64yum
# Install
yum install ./hello-0.0.0-1.x86_64.rpm
# Remove
yum remove -y helloapk
# Install
apk add --allow-untrusted hello-0.0.0-1.x86_64.apk
# Remove
apk del hello