上次写过简单的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. Java学习:异常的概念

    异常 异常概念 异常:指的是程序在执行过程中,出现的非正常的情况,最终导致JVM的非正常停止. 在Java等面向对象的编程语言中,异常本身是一个类,产生异常就是创建异常对象并抛出一个异常对象.Java ...

  2. FusionInsight大数据开发---Redis应用开发

    Redis应用开发 要求: 了解Redis应用场景 掌握Redis二次开发环境搭建 掌握Redis业务开发 Redis简介 Redis是一个基于网络的,高性能key-value内存数据库 Redis根 ...

  3. c#读取appsetting.json配置文件

    asp.net core 取消了web.config配置文件,而将appsetting.json作为了配置文件. 那么,怎么读取相关数据呢?这里我在appsetting.json中添加一些信息 第一种 ...

  4. WindowsXP序列号产生原理(椭圆曲线法)

    WindowsXP序列号产生原理(椭圆曲线法) 来源  https://blog.csdn.net/zhiyuan411/article/details/5156330 参考 https://www. ...

  5. Mysql之索引(六)

    1.思考 在图书馆是怎么找到一本书的? 一般的应用系统对比数据库的读写比例在10:1左右(即有10次查询有1次写操作),而且插入操作和更新操作很少出现性能问题. 遇到最多,最复杂的还是一些复杂的查询操 ...

  6. CodeForces 1228F One Node is Gone

    洛谷题目页面传送门 & CodeForces题目页面传送门 给定一棵树\(T=(V,E),|V|=2^n-2,|E|=2^n-3\),输出所有的\(x\),使得存在一棵满二叉树\(T'\),将 ...

  7. 使用input的file进行上传进行预览

    在使用file上传文件的时候,想到了图片预览的功能,然后查询了一些资料,一种是需要后端配合,将数据变成base64或者buff等数据传给后端然后调取接口进行显示,但是这种需要后端的配合和网络请求,感觉 ...

  8. [转] Cache 和 Buffer的区别

    程序员开发过程中经常会遇到“缓存”.“缓冲”等相似概念,之前没有特别关注,现在停下来做一下总结,才能更好地前行. 先来下枯燥的概念: 1.Cache:缓存区,是高速缓存,是位于CPU和主内存之间的容量 ...

  9. Kubernetes学习之基础概念

    本文章目录 kubernetes特性 kubernetes集群架构与组件 一.kubernetes集群架构 二.集群组件 三.ubernetes集群术语 深入理解Pod对象 一.Pod容器分类 基础容 ...

  10. Python之数据分析

    什么是数据分析? 运用不同行业中,专门从事行业数据搜集.整理.分析,并依据数据做出行业研究.评估和预测的专业人员. 熟悉行业知识.公司业务及流程,最好有自己独到的见解,若脱离行业认知和公司业务背景,分 ...