Comments (9)
容器里可以运行的话,在容器外应该也是正常的
v1.0 分支已经做得比较多的更新,的确没有 0.10 的大的。而且文档有一些变化,你可以阅读 https://github.com/go-xiaohei/pugo-io 里的文档,是最新的
from pugo.
✔ 已解决
当时也是感觉比较奇怪,容器里能运行,到了实际机器上就不行
今天加了 CGO_ENABLED=0
,这次编译得到的可以在 Host 正常运行了,对 go 的编译还是不太了解,记录一下过程
写了一个小脚本来进行编译,其它架构的平台换个 base image 应该就行
make-pi.sh
#!/bin/bash
#
# This script will build the executable and leave it in this directory.
#
IMAGE=yangxuan8282/golang:alpine
SRCDIR=/go/src/github.com/go-xiaohei/pugo
docker $DOCKER_OPTIONS run -t --rm -v "$PWD":$SRCDIR -e GOOS=${GOOS:-linux} -e GOARCH=${GOARCH:-arm} -e CGO_ENABLED=${CGO_ENABLED:-0} -w $SRCDIR $IMAGE go build .
先 git clone v1 分支:
git clone https://github.com/go-xiaohei/pugo -b v1
然后把上面那个 make-pi.sh
放进 clone 下来的 pugo
目录里,运行脚本
bash make-pi.sh
运行之后会在 pugo
目录留下一个可执行文件
另外这次编译完的比之前还要小一点
from pugo.
docker 的 linux 是 alpine ,go 似乎是要做专门的编译设置的,我还不是很了解,要去查询一下
from pugo.
这个 base image 只是我当时 build 时候选的用 alpine,其实用其它发行版也可以,只是因为 alpine 体积比较小一点
官方的 golang image 也有使用 alpine
作 base image 的,应该和默认的 tag ( Debian Jessie 当 base image ) 大体一样;之前编译别的 go 程序多数是可以直接在容器里 build 就行,但有些就得加 CGO_ENABLED=0
或其它参数才可以
另外发现 pugo 的 v1.0 分支和之前的版本是有些不同,命令少了一些,没有
pugo new post
这样的话文章的 toml
部分是不是只能自己来填了
还有一个问题是语言支持,我在 meta.toml
里改了 lang =
的值,改成了 "zh-cn"
,lang
目录下 zh-cn.toml
没汉化的部分也改成汉字了,但是最后访问页面还是全英文的,导航栏的文字依然显示英文
from pugo.
默认主题没有支持国际化内容的展示。。我在犹豫默认主题是否提供国际化。。从使用的角度直接去改模板里的文本和meta中导航的文本就可以了。一般情况的使用是不需要碰国际化的
from pugo.
这。。。那目前 lang
目录是不是就没有用了
感觉还是加入国际化支持比较好吧,不然不太方便;试了一下直接改 meta.toml
里 nav 对应的 title 可以把导航改成中文,不过剩下的比如 Read More, prev, next 就不知道该去改哪里了
另外问一下有没有可能自动生成 post 里的 toml
部分信息,比如把正文里一级标题当成 title
,时间自动填写,author
按第一篇 post 的作者的来,slug
改成类似 p/1234 这样,这样博客中一篇文章的地址就变成 http://localhost:9899/p/1234
这样,类似 v2ex
from pugo.
- 我把默认主题的国际化支持加上吧
- new post 这个会做的,具体怎么行为好没想好
- slug 这个目前不支持自定义,但是后续我会想办法来做
from pugo.
多谢了
from pugo.
alpine默认采用的C库使musl libc,不同于常用的linux发行版的glib c库。
默认如果不加CGO_ENABLED=1的话,编译出来的程序运行时,需要去找c库。如果编译时和运行时的C库不一致,自然会无法运行。如果CGO_ENABLED=0,会把c库也链接进去(这样会增大可执行文件大小)。运行时就不再需要host的C库了。
from pugo.
Related Issues (20)
- 内置服务增加一个md文件编辑功能 HOT 2
- 用的第三方包出错了,有些方法已经被弃用了。 HOT 2
- Too many open files HOT 4
- add details for post <!--more-->
- Embedded theme into pugo HOT 2
- disable post and page functions in meta file HOT 1
- optimize "copy“ progress HOT 1
- add json data support to page
- use file ModTime as post/page date if not set HOT 1
- add more types for model.Tree HOT 1
- more error-tolerant cases handler HOT 1
- model.Tree is able to get current node, get parent node for creating breadcrumb HOT 1
- 希望把依赖放到vender里面 HOT 4
- add tags.html to display tags list
- 增加一个给文章自动生成目录结构的功能 HOT 2
- official site update
- 发布静态文件到github和coding均无法加载js和css文件 HOT 3
- enable to change size of posts per page
- OpenBSD [ amd64 ] Support !
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pugo.