上次写过简单的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. 『LCA 树链剖分』

    LCA Description 给出一个n个节点的有根树(编号为0到n-1,根节点为0).一个点的深度定义为这个节点到根 的距离+1. 设dep[i]表示点i的深度,LCA(i,j)表示i与j的最近公 ...

  2. SET QUOTED_IDENTIFIER选项对索引的影响

    早上来到公司,发现用于整理索引碎片的Job跑失败了,查看job history,发现以下错误消息: ALTER INDEX failed because the following SET optio ...

  3. SpringBoot与PageHelper的整合示例详解

    SpringBoot与PageHelper的整合示例详解 1.PageHelper简介 PageHelper官网地址: https://pagehelper.github.io/ 摘要: com.gi ...

  4. Java自学-接口与继承 Object类

    Java中的超类 Object 步骤 1 : Object类是所有类的父类 声明一个类的时候,默认是继承了Object public class Hero extends Object package ...

  5. 【转载】C#使用InsertRange方法往ArrayList集合指定位置插入另一个集合

    在C#的编程开发中,ArrayList集合是一个常用的非泛型类集合,ArrayList集合可存储多种数据类型的对象.在实际的开发过程中,我们可以使用InsertRange方法在ArrayList集合指 ...

  6. ffmpeg 详解

    来源:http://blog.itpub.net/9399028/viewspace-1242300/ FFMPEG详解   认识FFMPEG FFMPEG堪称自由软件中最完备的一套多媒体支持库,它几 ...

  7. PHP应用如何对接微信公众号JSAPI支付

    微信支付的产品有很多,1. JSAPI支付  2. APP支付  3. Native支付  4.付款码支付  5. H5支付. 其中基于微信公众号开发的应用选择“JSAPI支付“产品,其他APP支付需 ...

  8. JAVA项目从运维部署到项目开发(四. Tomcat)

    一.关于中文乱码问题 文件目录:/conf/server.xml 将相关语句改为: <Connector port="8008" protocol="HTTP/1. ...

  9. 【优化】COUNT(1)、COUNT(*)、COUNT(常量)、COUNT(主键)、COUNT(ROWID)、COUNT(非空列)、COUNT(允许为空列)、COUNT(DISTINCT 列名)

    [优化]COUNT(1).COUNT(*).COUNT(常量).COUNT(主键).COUNT(ROWID).COUNT(非空列).COUNT(允许为空列).COUNT(DISTINCT 列名) 1. ...

  10. java.io.IOException: Premature EOF

    http访问第三方系统的接口时,小概率抛出下面的异常: java.io.IOException: Premature EOF at sun.net.www.http.ChunkedInputStrea ...