USAGE
gf pack SRC DST
ARGUMENT
SRC source path for packing, which can be multiple source paths.
DST destination file path for packed file. if extension of the filename is ".go" and "-n" option is given,
it enables packing SRC to go file, or else it packs SRC into a binary file.
OPTION
-n, --name package name for output go file, it's set as its directory name if no name passed
-p, --prefix prefix for each file packed into the resource file
-k, --keepPath keep the source path from system to resource file, usually for relative path
-h, --help more information about this command
EXAMPLE
gf pack public data.bin
gf pack public,template data.bin
gf pack public,template packed/data.go
gf pack public,template,config packed/data.go
gf pack public,template,config packed/data.go -n=packed -p=/var/www/my-app
gf pack /var/www/public packed/data.go -n=packed
$ gf pack resource/public,resource/template internal/packed/data.go -n boot
done!
生成文件data.go,内容省略
package boot
import "github.com/gogf/gf/v2/os/gres"
func init() {
if err := gres.Add("1f8b0800000000000"); err != nil {
panic("add binary content to resource manager failed: " + err.Error())
}
}
通过gres.Dump()打印
2023-09-28T07:08:11+00:00 0.00B public
2023-09-28T06:37:52+00:00 0.00B public/html
2023-09-28T06:37:52+00:00 0.00B public/html/.gitkeep
2023-09-28T06:37:52+00:00 0.00B public/plugin
2023-09-28T06:37:52+00:00 0.00B public/plugin/.gitkeep
2023-09-28T06:37:52+00:00 0.00B public/resource
2023-09-28T06:37:52+00:00 0.00B public/resource/css
2023-09-28T06:37:52+00:00 0.00B public/resource/css/.gitkeep
2023-09-28T06:37:52+00:00 0.00B public/resource/image
2023-09-28T06:37:52+00:00 0.00B public/resource/image/.gitkeep
2023-09-28T06:37:52+00:00 0.00B public/resource/js
2023-09-28T06:37:52+00:00 0.00B public/resource/js/.gitkeep
2023-09-28T07:08:11+00:00 0.00B template
2023-09-28T06:37:52+00:00 0.00B template/.gitkeep
$ gf docker -h
USAGE
gf docker [FILE] [OPTION]
ARGUMENT
FILE file path for "gf build", it's "main.go" in default.
OPTION the same options as "docker build" except some options as follows defined
OPTION
-p, --push auto push the docker image to docker registry if "-t" option passed
EXAMPLES
gf docker
gf docker -t hub.docker.com/john/image:tag
gf docker -p -t hub.docker.com/john/image:tag
gf docker main.go
gf docker main.go -t hub.docker.com/john/image:tag
gf docker main.go -t hub.docker.com/john/image:tag
gf docker main.go -p -t hub.docker.com/john/image:tag
DESCRIPTION
The "docker" command builds the GF project to a docker images. It runs "docker build"
command automatically, so you should have docker command first.
There must be a Dockerfile in the root of the project.
$gf docker main.go -p -t 10.130.44.133/test/gfcli:v1.0.0
2020-04-29 00:57:54.378 start building...
2020-04-29 00:57:54.379 go build -o ./bin/linux_amd64/main main.go
2020-04-29 00:57:55.849 done!
2020-04-29 00:57:55.943 docker build .
2020-04-29 00:57:56.831 docker push 10.130.44.133/test/gfcli:v1.0.0