golang(6):使用beego + ace admin 开发后台系统 CRUD,并且使
本文的原文连接是: 1,关于golang adminace admin 是一个非常好的后台系统ui。 github: 使用scratch 空镜像打包,20MB+ 2,代码说明详细的之前也写过了。不重复了: docker push docker.io/golangpkg/go-admin:latest
docker run --rm -it -p 8080:8080 docker.io/golangpkg/go-admin
效果: 3,遇到构建问题因为是用的scratch 在编译golang 之后发现 错误: standard_init_linux.go:190: exec user process caused "no such file or directory"
巨崩溃,因为就报了这一个错误,没有其他的。 env GOOS=linux GOARCH=amd64 CGO_ENABLED=1
go build -ldflags "-linkmode external -extldflags -static" -o go-admin main.go
还是参考rancher学习的。 在构建中使用 golang:stretch 基础镜像编译,然后在把文件拷贝出来。 在编译 sqlite 数据库驱动的时候报错: vendor/github.com/mattn/go-sqlite3/sqlite3_go18.go:18:10: undefined: SQLiteConn
发现是因为这个类是使用 cgo 调用的lib库,必须要libsqlite3-dev 开发包。 /go/src/github.com/freewebsys/go-admin/vendor/github.com/mattn/go-sqlite3/sqlite3-binding.c:35900: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/tmp/go-link-879145469/000003.o: In function `mygetgrouplist':
/tmp/workdir/go/src/os/user/getgrouplist_unix.go:15: warning: Using 'getgrouplist' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
不知道啥都打包进去了成了 20mb大小,要是没有sqlite 也就 10mb。 在push 到docker hub 上还遇到权限问题。 docker login -u golangpkg docker.io
docker push docker.io/golangpkg/go-admin:latest
golangpkg 是我申请的账号。 4,总结在构建一个镜像的,只把编译好的文件拷贝上去。 本文的原文连接是: (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |