web-debug-server

项目来自:https://github.com/itzg/web-debug-server

这位大哥的镜像做的很有意思:一个很小的web debug服务器,访问它可以显示请求的url和头信息

Dockerfile文件:

FROM scratch
COPY web-debug-server /
ENTRYPOINT ["/web-debug-server"]

代码是go语言写的,然后经Makefile编译

.PHONY: snapshot
snapshot:
goreleaser --snapshot --rm-dist
  • rm-dist 该发布需要一个干净的目录,该标志确保 /dist 目录会被删除。
  • snapshot 默认情况下,发布设置为 release 。此标志将关闭此操作。
  • goreleaser是一个针对不同操作系统进行编译需要安装正确的依赖包的问题

使用docker容器先来编译下

此处参考了:https://studygolang.com/articles/22242?fr=sidebar

参考了:https://goreleaser.com/

$ docker run --rm --privileged  -v $(pwd):/go/src/web-debug-server -w /go/src/web-debug-server goreleaser/goreleaser:latest-cgo release --snapshot --rm-dist
  • -v $(pwd):/go/src/web-debug-server将本地目录再docker容器做了一个挂载
  • -w /go/src/web-debug-server指定了下工作目录

可以看到编译过程中创建了不同操作系统的二进制文件

...
• BUILDING BINARIES
• building binary=dist/web-debug-server_windows_amd64/web-debug-server.exe
• building binary=dist/web-debug-server_linux_amd64/web-debug-server
• building binary=dist/web-debug-server_linux_arm_6/web-debug-server
• building binary=dist/web-debug-server_darwin_amd64/web-debug-server
...
web-debug-server]$ tree -C .
.
├── dist
│   ├── config.yaml
│   ├── web-debug-server_linux_amd64
│   │   └── web-debug-server
│   ├── web-debug-server_linux_arm_6
│   │   └── web-debug-server
│   └── web-debug-server_windows_amd64
│   └── web-debug-server.exe
├── Dockerfile
├── go.mod
├── go.sum
├── main.go
├── Makefile
└── README.md 4 directories, 10 files
web-debug-server]$ file dist/web-debug-server_linux_amd64/web-debug-server
dist/web-debug-server_linux_amd64/web-debug-server: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, stripped

然后将该二进制文件放入Dockerfile(官方应该有构建不同平台镜像的教程)

FROM scratch
COPY dist/web-debug-server_linux_amd64/web-debug-server /
ENTRYPOINT ["/web-debug-server"]

docker run

$ docker run -it --rm -p 8080:8080 web-debug-server

效果:有点意思

web-debug-server的更多相关文章

  1. web cache server方案比较:varnish、squid、nginx

    linux运维中,web cache server方案的部署是一个很重要的环节,选择也有很多种比如:varnish.squid.nginx.下面就对当下常用的这几个web cache server做一 ...

  2. Office Web Apps Server 概述

    Office Web Apps Server 是新的 Office 服务器产品,它提供 Word.PowerPoint.Excel 和 OneNote 的基于浏览器的版本.单个 Office Web ...

  3. [转载]部署Office Web Apps Server并配置其与SharePoint 2013的集成

    Office Web Apps Server 是新的 Office 服务器产品,它提供 Word.PowerPoint.Excel 和 OneNote 的基于浏览器的版本.单个 Office Web ...

  4. 部署Office Web Apps Server并配置其与SharePoint 2013的集成

    部署Office Web Apps Server并配置其与SharePoint 2013的集成   Office Web Apps Server 是新的 Office 服务器产品,它提供 Word.P ...

  5. office web apps server 问题和解决办法

    New-OfficeWebAppsFarm –InternalURL "http://owa.zjkhlib.com" –AllowHttp –EditingEnabled 错误1 ...

  6. Office Web Apps Server

    Office Web Apps Server Office Web Apps Server 是一款 Office 服务器产品,可提供针对 Office 文件的基于浏览器的文件查看和编辑服务.Offic ...

  7. office web apps server安装部署

    操作系统:windows 2012 软件下载地址: 链接:https://pan.baidu.com/s/1c3WWFs8 密码:4dcy NDP452-KB2901954-Web.exe(.Net ...

  8. office web app server部署和简单操作

    部署环境:windows server 2012 R2,服务器在AD域中 参考网址: https://msdn.microsoft.com/zh-cn/magazine/jj219455(office ...

  9. Simple Web API Server in Golang (2)

    In this challenge, I tried to implement a simple OAuth2 server basing on Simple Web API Server in [1 ...

  10. Simple Web API Server in Golang (1)

    To be an better Gopher, get your hands dirty. Topcoder offered a serials of challenges for learning ...

随机推荐

  1. C#7语法快速参考-第一章 Hello World

    选择IDE 要开始使用C#编程,您需要一个支持微软.NET框架的集成开发环境(IDE).最受欢迎的选择是微软自己的Visual Studio.初学可以使用Visual Studio Community ...

  2. JS--插件: 树Tree 开发与实现

    日常在Web项目开发时,经常会碰到树形架构数据的显示,从数据库中获取数据,并且显示成树形.为了方便,我们可以写一个javascript的一个跨浏览器树控件,后续可以重复使用.本节分享一个自己开发的JS ...

  3. 设置ItelliJ IDEA里修改jsp不重启tomcat

    设置ItelliJ IDEA里修改jsp不重启tomcat On Upate Action 与 On Frame Deactivation 这两个选项的设置,依赖于 项目的部署方式 是war包 还是 ...

  4. android 实时获取网速

    public class NetSpeed { private static final String TAG = NetSpeed.class.getSimpleName(); private lo ...

  5. Python之request模块-基础用法

    Request模块参考中文手册:https://requests.readthedocs.io/zh_CN/latest/ Request模块 1.查看pip已装包(模块)的安装信息(模块的路径.版本 ...

  6. Linux操作系统安全-加密和安全扫盲篇

    Linux操作系统安全-加密和安全 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.墨菲定律 墨菲定律: 一种心理学效应,是由爱德华·墨菲(Edward A. Murphy)提出 ...

  7. 团队项目-Alpha版本发布1

    此次作业的目的是让同学们在这个星期内完成团队项目α版本的第一次测试和发布,为发布下一次的 α版本做一个准备和前期检验. 1.作业要求: 提交一份α版本冲刺博客 2.博客要求: (1)请大家在作业开头添 ...

  8. BSGS算法(大小步算法)

    $BSGS$ 算法 $Baby\ Steps\ Giant\ Steps$. 致力于解决给定两个互质的数 $a,\ p$ 求一个最小的非负整数 $x$ 使得 $a^x\equiv b(mod\ p)$ ...

  9. Spring Cloud Turbine 知识点

    Turbine 默认使用 Eureka 作为注册中心:如果使用 Consul 作为注册中心,需要排除掉 Eureka:pom.xml 如下: <dependency> <groupI ...

  10. nginx 代理服务

    1.nginx反向代理服务 location ~ /test_proxy.html$ { proxy_pass http://127.0.0.1:8080;(代理访问127.0.0.1:8080) } ...