上次写过简单的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. go 学习笔记---chan

    如果说 goroutine 是 Go语言程序的并发体的话,那么 channels 就是它们之间的通信机制.一个 channels 是一个通信机制,它可以让一个 goroutine 通过它给另一个 go ...

  2. 在浏览器中输入 url 地址到显示主页的过程

    总体来说分为以下几个过程:1. DNS 解析2. TCP 连接3. 发送 HTTP 请求4. 服务器处理请求并返回 HTTP 报文5. 浏览器解析渲染页面6. 连接结束

  3. Java自学-类和对象 属性初始化

    如何进行Java的属性初始化 步骤 1 : 对象属性初始化 对象属性初始化有3种 声明该属性的时候初始化 构造方法中初始化 初始化块 . public class Hero { public Stri ...

  4. iOS - 架构的认识过程,悬崖勒马。

    16年的时候写过一篇代码讲解的,依旧是这三种架构,现在20年将近了,看到好的文章,是否增加新的认识. 16年链接 iOS - 架构模式 - 解密 MVC.MVP.MVVM.VIPER架构 新项目选择架 ...

  5. python中的exec()函数和eval()函数

    exec()函数 exec函数用于执行存储在字符串中的python语句 >>> exec("x=1") >>> x 但有时候,直接这样执行可能会 ...

  6. C#实体类与XML相互转换

    1.实体类与XML相互转换 将实体类转换成XML需要使用XmlSerializer类的Serialize方法,将实体类序列化. 把XML转换成相应的实体类,需要使用到XmlSerializer类的De ...

  7. 基于gin框架搭建的一个简单的web服务

    刚把go编程基础知识学习完了,学习的时间很短,可能还有的没有完全吸收.不过还是在项目中发现知识,然后在去回顾已学的知识,现在利用gin这个web框架做一个简单的CRUD操作. 1.Go Web框架的技 ...

  8. SpringCloud2.0 Feign 服务发现 基础教程(五)

    1.启动[服务中心]集群,即 Eureka Server 参考 SpringCloud2.0 Eureka Server 服务中心 基础教程(二) 2.启动[服务提供者]集群,即 Eureka Cli ...

  9. 熟练掌握GitHub及Git的使用方法

    一.Git 命令的理解和使用 Git是一个快速,可扩展的分布式版本控制系统,具有异常丰富的命令集,可提供高级操作和对内部的完全访问. 分布式:Git版本控制系统是一个分布式的系统,是用来保存工程源代码 ...

  10. splunk dga

    https://splunkbase.splunk.com/app/3559/ 详细参考: https://www.slideshare.net/Splunk/using-machine-learni ...