Giter Club home page Giter Club logo

go-demo-gin's Introduction

go-demo-gin

go demo with gin, support docker and docker-compose

Env

  • go1.14.4+
  • platform: Linux|Unix|Mac OS

GO Proxy 配置

export GOPROXY=https://goproxy.cn,https://goproxy.io/,https://mirrors.aliyun.com/goproxy/,https://gocenter.io/,https://proxy.golang.org,direct

# 私有仓库,公司仓库
export GOPRIVATE=*.example.com

Compile & Run

  • make run or go build

具体命令请参考: Makefile 文件

Docker build & start

  • make docker 创建镜像
  • make docker-start 镜像启动
  • make docker-version 二进制版本 version
  • bash docker/docker-startup.sh 镜像启动
  • docker-compose up docker-compose 方式启动

Base docker images

Tip

  • docker-startup.sh 启动脚本中输入参数,务必使用 $PARAMS 而非 "$PARAMS"!
  • $PARAMS 为空,则执行默认命令; 输入 "$PARAMS" 可能会被当做 " " 参数,会造成未知影响!
  • 使用 upx 压缩二进制可执行程序,减小 image 或可执行程序大小(30%-50%),brew install upx 安装,执行 make upx
  • 测试服务器测试,借助vendor目录加速构建 make docker-mod

Deploy

  • 创建镜像 make docker-build-dev|make docker-build-uat|make docker-build-prod
  • 镜像推送 推送生成的镜像到 corp 镜像仓库
  • 镜像使用 选择要发布的镜像版本,发布即可,默认启动
  • 开发测试部署 make deploy 借助 docker, docker-compose

go-demo-gin's People

Watchers

 avatar  avatar

Forkers

sefxl

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.