Skip to content

Commit

Permalink
Add rpm & deb build script with nfpm (#1136)
Browse files Browse the repository at this point in the history
* add rpm & deb build script with nfpm
* add license comment to nfpm build script
* add upx shortcuts to makefile
* reduce executable size with upx
  • Loading branch information
Vonng authored Jun 20, 2022
1 parent b4cef5a commit 500a23f
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,22 @@ build-arm64:
CGO_ENABLED=${CGO_ENABLED} GOOS=${OS} GOARCH=arm64 go build ${LDFLAGS} -o $(shell pwd)/bin/${OS}_arm64/sealos -tags "containers_image_openpgp" cmd/sealos/main.go
CGO_ENABLED=0 GOOS=${OS} GOARCH=arm64 go build ${LDFLAGS} -o $(shell pwd)/bin/${OS}_arm64/seactl -tags "containers_image_openpgp" cmd/sealctl/main.go

# upx is required for this
upx: upx-amd64 upx-arm64
upx-amd64:
cd bin/linux_amd64/ ; upx sealos ; upx seactl
upx-arm64:
cd bin/linux_arm64/ ; upx sealos ; upx seactl

# nfpm is required for making rpm & deb
package: package-amd64 package-arm64
package-amd64:
nfpm package -p rpm -f amd64.yaml -t bin/linux_amd64/
nfpm package -p deb -f amd64.yaml -t bin/linux_amd64/
package-arm64:
nfpm package -p rpm -f arm64.yaml -t bin/linux_arm64/
nfpm package -p deb -f arm64.yaml -t bin/linux_arm64/

import:
goimports -l -w cmd
goimports -l -w pkg
Expand Down
30 changes: 30 additions & 0 deletions amd64.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#// Copyright © 2021 sealos.
#//
#// Licensed under the Apache License, Version 2.0 (the "License");
#// you may not use this file except in compliance with the License.
#// You may obtain a copy of the License at
#//
#// http://www.apache.org/licenses/LICENSE-2.0
#//
#// Unless required by applicable law or agreed to in writing, software
#// distributed under the License is distributed on an "AS IS" BASIS,
#// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#// See the License for the specific language governing permissions and
#// limitations under the License.
name: "sealos"
arch: "amd64"
platform: "linux"
version: "v4.0.0"
version_schema: semver
maintainer: fanux(https://github.com/fanux)
description: Cloud OS distribution with Kubernetes as kernel
vendor: "https://github.com/fanux"
homepage: "https://github.com/labring/sealos"
license: "Apache-2.0 License"

contents:
- src: ./bin/linux_amd64/seactl
dst: /usr/bin/sealos

- src: ./bin/linux_amd64/
dst: /usr/bin/sealos
30 changes: 30 additions & 0 deletions arm64.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright © 2021 sealos.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: "sealos"
arch: "arm64"
platform: "linux"
version: "v4.0.0"
version_schema: semver
maintainer: fanux(https://github.com/fanux)
description: Cloud OS distribution with Kubernetes as kernel
vendor: "https://github.com/fanux"
homepage: "https://github.com/labring/sealos"
license: "Apache-2.0 License"

contents:
- src: ./bin/linux_arm64/seactl
dst: /usr/bin/sealos

- src: ./bin/linux_arm64/
dst: /usr/bin/sealos

0 comments on commit 500a23f

Please sign in to comment.