上次写过简单的s3-sftp-proxy基于容器构建以及使用goreleaser构建跨平台二进制文件的,下边演示下关于
rpm&&deb 包的制作,我们只需要简单的配置就可以生成方便安装的软件包

项目代码

https://github.com/rongfengliang/s3-sftp-proxy-docker

环境准备

  • goreleaser 安装
    这个官方提供了不同平台的安装包,选择对应的就可以了
  • 配置项目.goreleaser.yml 文件
    内容如下:
 
# This is an example goreleaser.yaml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
project_name: s3-sftp-proxy
before:
  hooks:
    # you may remove this if you don't use vgo
    - sh goproxy.sh
    - go mod download
builds:
- env:
  - CGO_ENABLED=0
  goos:
  - freebsd
  - windows
  - darwin
  - linux
  goarch:
  - amd64
  - arm
  - arm64
archive:
  replacements:
    darwin: Darwin
    linux: Linux
    windows: Windows
    386: i386
    amd64: x86_64
checksum:
  name_template: 'checksums.txt'
changelog:
  sort: asc
  filters:
    exclude:
    - '^docs:'
    - '^test:'
nfpms:
  - 
    id: s3-sftp-proxy
    builds:
    - s3-sftp-proxy
    name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
    # Replacements for GOOS and GOARCH in the package name.
    # Keys should be valid GOOSs or GOARCHs.
    # Values are the respective replacements.
    # Default is empty.
    replacements:
      amd64: 64-bit
      386: 32-bit
      darwin: macOS
      linux: linux
    vendor: dalongrong.
    homepage: https://github.com/rongfengliang/
    # Your app's maintainer (probably you).
    # Default is empty.
    maintainer: 1141591465@qq.com
    # Your app's description.
    # Default is empty.
    description: s3-sftp-proxy
    # Your app's license.
    # Default is empty.
    license: Apache 2.0
    # Formats to be generated.
    formats:
      - deb
      - rpm
    # Override default /usr/local/bin destination for binaries
    bindir: /usr/bin
    empty_folders:
    - /var/log/s3-sftp-proxy
    config_files:
      "s3-sftp-proxy.example.toml": "/etc/s3-sftp-proxy.conf"
    # Scripts to execute during the installation of the package.
    # Keys are the possible targets during the installation process
    # Values are the paths to the scripts which will be executed
    scripts:
      postinstall: "scripts/postinstall.sh"
    # Some attributes can be overrided per package format.
    overrides:
      deb:
        empty_folders:
        - /var/log/bar
      rpm:
        replacements:
          amd64: x86_64
        name_template: "{{ .ProjectName }}-{{ .Version }}-{{ .Arch }}"
        config_files:
          "s3-sftp-proxy.example.toml": "/etc/s3-sftp-proxy.toml"
  • goreleaser版本简单说明
    对于rpm以及deb 包的生成,我们需要比较新的goreleaser版本,最好是下载官方最新的版本
  • 配置说明
    我们可以配置安装的依赖,软件安装以及卸载的自定义脚本,同时对于配置文件我们也可以通过配置本地与安装之后的目录映射
    可以参考上边yaml 文件中nfpms 的配置映射

构建效果

  • 构建命令
 
goreleaser release --rm-dist
  • 效果
goreleaser release --rm-dist
   • releasing using goreleaser 0.115.0...
   • loading config file file=.goreleaser.yml
   • RUNNING BEFORE HOOKS
      • running sh goproxy.sh
      • running go mod download
   • LOADING ENVIRONMENT VARIABLES
   • GETTING AND VALIDATING GIT STATE
      • releasing v2.2, commit 396c3cd6c88030ac9b98262c51d48516442b7c58
   • PARSING TAG      
   • SETTING DEFAULTS 
      • LOADING ENVIRONMENT VARIABLES
      • SNAPSHOTING      
      • GITHUB/GITLAB RELEASES
      • PROJECT NAME     
      • BUILDING BINARIES
      • ARCHIVES         
            • DEPRECATED: `archive` should not be used anymore, check https://goreleaser.com/deprecations#archive for more info.
      • LINUX PACKAGES WITH NFPM
      • SNAPCRAFT PACKAGES
      • CALCULATING CHECKSUMS
      • SIGNING ARTIFACTS
      • DOCKER IMAGES    
      • ARTIFACTORY      
      • S3               
      • BLOB             
      • HOMEBREW TAP FORMULA
         • optimistically guessing `brew[0].installs`, double check
      • SCOOP MANIFEST   
   • SNAPSHOTING      
      • pipe skipped error=not a snapshot
   • CHECKING ./DIST  
      • --rm-dist is set, cleaning it up
   • WRITING EFFECTIVE CONFIG FILE
      • writing config=dist/config.yaml
   • GENERATING CHANGELOG
      • writing changelog=dist/CHANGELOG.md
   • BUILDING BINARIES
      • building binary=dist/s3-sftp-proxy_linux_arm64/s3-sftp-proxy
      • building binary=dist/s3-sftp-proxy_windows_amd64/s3-sftp-proxy.exe
      • building binary=dist/s3-sftp-proxy_freebsd_amd64/s3-sftp-proxy
      • building binary=dist/s3-sftp-proxy_linux_amd64/s3-sftp-proxy
      • building binary=dist/s3-sftp-proxy_darwin_amd64/s3-sftp-proxy
      • building binary=dist/s3-sftp-proxy_freebsd_arm_6/s3-sftp-proxy
      • building binary=dist/s3-sftp-proxy_linux_arm_6/s3-sftp-proxy
   • ARCHIVES         
      • creating archive=dist/s3-sftp-proxy_2.2_Linux_arm64.tar.gz
      • creating archive=dist/s3-sftp-proxy_2.2_Windows_x86_64.tar.gz
      • creating archive=dist/s3-sftp-proxy_2.2_Linux_armv6.tar.gz
      • creating archive=dist/s3-sftp-proxy_2.2_Linux_x86_64.tar.gz
      • creating archive=dist/s3-sftp-proxy_2.2_Darwin_x86_64.tar.gz
      • creating archive=dist/s3-sftp-proxy_2.2_freebsd_armv6.tar.gz
      • creating archive=dist/s3-sftp-proxy_2.2_freebsd_x86_64.tar.gz
   • LINUX PACKAGES WITH NFPM
      • creating arch=armhf file=dist/s3-sftp-proxy-2.2-arm.rpm package=s3-sftp-proxy-2.2-arm.rpm
      • creating arch=amd64 file=dist/s3-sftp-proxy-2.2-x86_64.rpm package=s3-sftp-proxy-2.2-x86_64.rpm
      • creating arch=amd64 file=dist/s3-sftp-proxy_2.2_linux_64-bit.deb package=s3-sftp-proxy_2.2_linux_64-bit.deb
      • creating arch=arm64 file=dist/s3-sftp-proxy-2.2-arm64.rpm package=s3-sftp-proxy-2.2-arm64.rpm
      • creating arch=armhf file=dist/s3-sftp-proxy_2.2_linux_arm.deb package=s3-sftp-proxy_2.2_linux_arm.deb
      • creating arch=arm64 file=dist/s3-sftp-proxy_2.2_linux_arm64.deb package=s3-sftp-proxy_2.2_linux_arm64.deb
   • SNAPCRAFT PACKAGES
      • pipe skipped error=no summary nor description were provided
   • CALCULATING CHECKSUMS
      • checksumming file=s3-sftp-proxy-2.2-x86_64.rpm
      • checksumming file=s3-sftp-proxy_2.2_Linux_x86_64.tar.gz
      • checksumming file=s3-sftp-proxy_2.2_linux_64-bit.deb
      • checksumming file=s3-sftp-proxy_2.2_linux_arm64.deb
      • checksumming file=s3-sftp-proxy_2.2_Darwin_x86_64.tar.gz
      • checksumming file=s3-sftp-proxy_2.2_freebsd_armv6.tar.gz
      • checksumming file=s3-sftp-proxy_2.2_linux_arm.deb
      • checksumming file=s3-sftp-proxy_2.2_Linux_arm64.tar.gz
      • checksumming file=s3-sftp-proxy_2.2_freebsd_x86_64.tar.gz
      • checksumming file=s3-sftp-proxy_2.2_Linux_armv6.tar.gz
      • checksumming file=s3-sftp-proxy-2.2-arm.rpm
      • checksumming file=s3-sftp-proxy_2.2_Windows_x86_64.tar.gz
      • checksumming file=s3-sftp-proxy-2.2-arm64.rpm
   • SIGNING ARTIFACTS
      • pipe skipped error=artifact signing is disabled
   • DOCKER IMAGES    
      • pipe skipped error=docker section is not configured
   • PUBLISHING       
      • S3               
         • pipe skipped error=s3 section is not configured
      • BLOB             
         • pipe skipped error=Blob section is not configured
      • HTTP PUT         
         • pipe skipped error=put section is not configured
      • ARTIFACTORY      
         • pipe skipped error=artifactory section is not configured
      • DOCKER IMAGES    
      • SNAPCRAFT PACKAGES
      • GITHUB/GITLAB RELEASES
         • creating or updating release repo=rongfengliang/s3-sftp-proxy-docker tag=v2.2
         • release updated url=https://github.com/rongfengliang/s3-sftp-proxy-docker/releases/tag/v2.2
         • uploading to release file=dist/checksums.txt name=checksums.txt
         • uploading to release file=dist/s3-sftp-proxy_2.2_Linux_arm64.tar.gz name=s3-sftp-proxy_2.2_Linux_arm64.tar.gz
         • uploading to release file=dist/s3-sftp-proxy_2.2_freebsd_armv6.tar.gz name=s3-sftp-proxy_2.2_freebsd_armv6.tar.gz
         • uploading to release file=dist/s3-sftp-proxy_2.2_Windows_x86_64.tar.gz name=s3-sftp-proxy_2.2_Windows_x86_64.tar.gz
         • failed to upload artifact, will retry artifact=s3-sftp-proxy_2.2_freebsd_armv6.tar.gz try=0
         • failed to upload artifact, will retry artifact=s3-sftp-proxy_2.2_Windows_x86_64.tar.gz try=0
         • uploading to release file=dist/s3-sftp-proxy_2.2_freebsd_armv6.tar.gz name=s3-sftp-proxy_2.2_freebsd_armv6.tar.gz
         • uploading to release file=dist/s3-sftp-proxy_2.2_Windows_x86_64.tar.gz name=s3-sftp-proxy_2.2_Windows_x86_64.tar.gz
         • failed to upload artifact, will retry artifact=checksums.txt try=0
         • uploading to release file=dist/checksums.txt name=checksums.txt
         • failed to upload artifact, will retry artifact=s3-sftp-proxy_2.2_Linux_arm64.tar.gz try=0
         • uploading to release file=dist/s3-sftp-proxy_2.2_Linux_arm64.tar.gz name=s3-sftp-proxy_2.2_Linux_arm64.tar.gz
         • failed to upload artifact, will retry artifact=s3-sftp-proxy_2.2_freebsd_armv6.tar.gz try=1
         • uploading to release file=dist/s3-sftp-proxy_2.2_freebsd_armv6.tar.gz name=s3-sftp-proxy_2.2_freebsd_armv6.tar.gz
         • failed to upload artifact, will retry artifact=s3-sftp-proxy_2.2_Windows_x86_64.tar.gz try=1
         • uploading to release file=dist/s3-sftp-proxy_2.2_Windows_x86_64.tar.gz name=s3-sftp-proxy_2.2_Windows_x86_64.tar.gz
         • failed to upload artifact, will retry artifact=s3-sftp-proxy_2.2_Linux_arm64.tar.gz try=1
         • uploading to release file=dist/s3-sftp-proxy_2.2_Linux_arm64.tar.gz name=s3-sftp-proxy_2.2_Linux_arm64.tar.gz
         • failed to upload artifact, will retry artifact=checksums.txt try=1
         • uploading to release file=dist/checksums.txt name=checksums.txt
         • failed to upload artifact, will retry artifact=s3-sftp-proxy_2.2_freebsd_armv6.tar.gz try=2
         • uploading to release file=dist/s3-sftp-proxy_2.2_freebsd_armv6.tar.gz name=s3-sftp-proxy_2.2_freebsd_armv6.tar.gz
         • failed to upload artifact, will retry artifact=s3-sftp-proxy_2.2_Windows_x86_64.tar.gz try=2
         • uploading to release file=dist/s3-sftp-proxy_2.2_Windows_x86_64.tar.gz name=s3-sftp-proxy_2.2_Windows_x86_64.tar.gz
         • failed to upload artifact, will retry artifact=s3-sftp-proxy_2.2_Linux_arm64.tar.gz try=2
         • uploading to release file=dist/s3-sftp-proxy_2.2_Linux_arm64.tar.gz name=s3-sftp-proxy_2.2_Linux_arm64.tar.gz
         • failed to upload artifact, will retry artifact=checksums.txt try=2
         • uploading to release file=dist/checksums.txt name=checksums.txt
         • failed to upload artifact, will retry artifact=s3-sftp-proxy_2.2_freebsd_armv6.tar.gz try=3
         • uploading to release file=dist/s3-sftp-proxy_2.2_freebsd_armv6.tar.gz name=s3-sftp-proxy_2.2_freebsd_armv6.tar.gz
         • failed to upload artifact, will retry artifact=s3-sftp-proxy_2.2_Linux_arm64.tar.gz try=3
         • uploading to release file=dist/s3-sftp-proxy_2.2_Linux_arm64.tar.gz name=s3-sftp-proxy_2.2_Linux_arm64.tar.gz
         • failed to upload artifact, will retry artifact=checksums.txt try=3
         • uploading to release file=dist/checksums.txt name=checksums.txt
         • failed to upload artifact, will retry artifact=s3-sftp-proxy_2.2_Windows_x86_64.tar.gz try=3
         • uploading to release file=dist/s3-sftp-proxy_2.2_Windows_x86_64.tar.gz name=s3-sftp-proxy_2.2_Windows_x86_64.tar.gz
         • failed to upload artifact, will retry artifact=s3-sftp-proxy_2.2_Linux_arm64.tar.gz try=4
         • failed to upload artifact, will retry artifact=s3-sftp-proxy_2.2_freebsd_armv6.tar.gz try=4
         • uploading to release file=dist/s3-sftp-proxy_2.2_Linux_arm64.tar.gz name=s3-sftp-proxy_2.2_Linux_arm64.tar.gz
         • failed to upload artifact, will retry artifact=checksums.txt try=4
         • uploading to release file=dist/s3-sftp-proxy_2.2_freebsd_armv6.tar.gz name=s3-sftp-proxy_2.2_freebsd_armv6.tar.gz
         • uploading to release file=dist/checksums.txt name=checksums.txt
         • failed to upload artifact, will retry artifact=s3-sftp-proxy_2.2_Windows_x86_64.tar.gz try=4
         • failed to upload artifact, will retry artifact=s3-sftp-proxy_2.2_Linux_arm64.tar.gz try=5
         • uploading to release file=dist/s3-sftp-proxy_2.2_Windows_x86_64.tar.gz name=s3-sftp-proxy_2.2_Windows_x86_64.tar.gz
         • uploading to release file=dist/s3-sftp-proxy_2.2_Linux_arm64.tar.gz name=s3-sftp-proxy_2.2_Linux_arm64.tar.gz
         • failed to upload artifact, will retry artifact=checksums.txt try=5
         • failed to upload artifact, will retry artifact=s3-sftp-proxy_2.2_freebsd_armv6.tar.gz try=5
         • uploading to release file=dist/checksums.txt name=checksums.txt
         • uploading to release file=dist/s3-sftp-proxy_2.2_freebsd_armv6.tar.gz name=s3-sftp-proxy_2.2_freebsd_armv6.tar.gz
         • failed to upload artifact, will retry artifact=s3-sftp-proxy_2.2_Windows_x86_64.tar.gz t

参考资料

https://github.com/rongfengliang/s3-sftp-proxy-docker
https://github.com/goreleaser/goreleaser/releases
https://goreleaser.com/customization

s3-sftp-proxy goreleaser rpm &&deb 包制作的更多相关文章

  1. deb包制作(转)

    deb 包已被广泛应用但是也在不断的更新,这里介绍Ubuntu deb包安装设置使用,帮助大家安装更新Ubuntu deb包系统.制作Ubuntu deb包的三种方法 | Sean's Blog [转 ...

  2. vigil deb 包制作

    前边有写过简单rpm 包的制作,现在制作一个简单的deb 包. deb 包的制作是通过源码编译+ fpm 环境准备 rust curl https://sh.rustup.rs -sSf | sh 配 ...

  3. deb包制作

    制作deb包 方法一:checkinstall checkinstall的原理就是将make install的内容放到一个临时目录然后打包,只要能执行make install就能创建deb包,如果代码 ...

  4. rpm和deb包制作和升级执行步骤

    deb安装包升级和安装都是dpkg -i .deb命令,升级时直接覆盖安装新包安装步骤:1 preinst install2 postinst configure升级步骤:1 先执行旧包prerm u ...

  5. ubuntu 制作deb 包

    ubuntu下打包制作deb安装包 http://www.th7.cn/system/lin/201406/61012.shtml   2014-06-22 20:16:45CSDN-yangbing ...

  6. deb包+软件图标+添加到系统菜单+举例安装卸载

    本文介绍的内容和实验一下: 1. 制造deb包.2. 为了使软件图标.3. 开始菜单中添加到系统中的软件:4. 安装和卸载制作的deb包. 1. 制作deb包 制作deb包的方法可能有多种,本文使用的 ...

  7. 从源代码制作deb包的两种方法以及修改已有deb包(转载)

    From:http://yysfire.github.io/linux/%E4%BB%8E%E6%BA%90%E4%BB%A3%E7%A0%81%E5%88%B6%E4%BD%9Cdeb%E5%8C% ...

  8. RPM包制作方法

    一.RPM介绍 RPM 前是Red Hat Package Manager 的缩写,本意是Red Hat 软件包管理,顾名思义是Red Hat 贡献出来的软件包管理:现在应为RPM Package M ...

  9. Ubuntu下制作deb包的方法详解

    1  认识deb包 1.1   认识deb包 deb是Unix系统(其实主要是Linux)下的安装包,基于 tar 包,因此本身会记录文件的权限(读/写/可执行)以及所有者/用户组. 由于 Unix ...

随机推荐

  1. Linux学习笔记之RAID笔记

    RAID: Redundant Arrays of Inexpensive Disks Independent Berkeley: A case for Redundent Arrays of Ine ...

  2. 用Java访问带有Kerberos认证的HBase

    程序代码实例如下:    package com.hbasedemo; import java.io.IOException; import org.apache.hadoop.conf.Config ...

  3. javascript Class.method vs Class.prototype.method(类方法和对象方法)

    在stackoverflow上看到一个这样的提问,以下代码有什么区别? Class.method = function () { /* code */ } Class.prototype.method ...

  4. prometheus消耗内存问题

    参考: https://stackoverflow.com/questions/56115912/why-does-prometheus-consume-so-much-memory https:// ...

  5. Python3字典与集合

    一.Python3字典 字典是另一种可变容器模型,且可存储任意类型对象字典的每个键值(key=>value)对用冒号":"分割,每个键值对之间用逗号"," ...

  6. Django---路由系统,URLconf的配置,正则表达式的说明(位置参数),分组命名(捕获关键字参数),传递额外的参数给视图,命名url和url的反向解析,url名称空间

    Django---路由系统,URLconf的配置,正则表达式的说明(位置参数),分组命名(捕获关键字参数),传递额外的参数给视图,命名url和url的反向解析,url名称空间 一丶URLconf配置 ...

  7. 查看Linux内核版本

    您可能因多种原因需要确切知道GNU / Linux操作系统上运行的内核版本. 也许您正在调试与硬件相关的问题,或者了解影响旧内核版本的新安全漏洞,并且您想知道您的内核是否易受攻击. 无论是什么原因,从 ...

  8. MybatisGenerator生成SSM的dao层

    官网下载 mybatis generator 下载generator的release版本mybatis-generator-core-1.4.0-bundle.zip https://github.c ...

  9. ReactiveObjC basic

    基础-> https://www.jianshu.com/p/cd4031fbf8ff 在RAC中,万物皆信号. RAC 指的就是 RactiveCocoa ,是 Github 的一个开源框架, ...

  10. ORACLE数据库导出表,字段名,长度,类型,字段注释,表注释语句

    转自:https://www.cnblogs.com/superming/p/11040455.html --数据库导出表,字段名,长度,类型,字段注释,表注释语句 SELECT T1.TABLE_N ...