From fd38208031cbf783880436419bed084e7f4205ef Mon Sep 17 00:00:00 2001 From: ehlxr Date: Wed, 6 Jun 2018 11:43:25 +0800 Subject: [PATCH 1/2] update Dockerfile --- Dockerfile | 11 +++++++---- start.sh | 10 +++++----- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 46e972e2..6243d34e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM golang:1.10-alpine3.7 # add china aliyun repo 新增了 alpine 3.6 的阿里源 -RUN cp /etc/apk/repositories /etc/apk/repositories.back && \ +RUN cp /etc/apk/repositories /etc/apk/repositories.back && \ echo "https://mirrors.aliyun.com/alpine/v3.6/main/" > /etc/apk/repositories && \ echo "https://mirrors.aliyun.com/alpine/v3.6/community/" >> /etc/apk/repositories @@ -11,11 +11,14 @@ ADD . /go/src/github.com/lifei6671/mindoc WORKDIR /go/src/github.com/lifei6671/mindoc -RUN chmod +x start.sh - -RUN go get -u github.com/golang/dep/cmd/dep && dep ensure && \ +RUN go get -u github.com/golang/dep/cmd/dep && dep ensure && \ CGO_ENABLE=1 go build -v -o mindoc_linux_amd64 -ldflags="-w -X main.VERSION=$TAG -X 'main.BUILD_TIME=`date`' -X 'main.GO_VERSION=`go version`'" && \ rm -rf commands controllers models modules routers tasks vendor docs search data utils graphics .git Godeps uploads/* .gitignore .travis.yml Dockerfile gide.yaml LICENSE main.go README.md conf/enumerate.go conf/mail.go install.lock +FROM nginx:alpine +LABEL maintainer="ehlxr.me@gmail.com" +WORKDIR /mindoc +COPY --from=0 /go/src/github.com/lifei6671/mindoc . +RUN chmod +x start.sh CMD ["./start.sh"] \ No newline at end of file diff --git a/start.sh b/start.sh index a3103342..3fc9e73d 100644 --- a/start.sh +++ b/start.sh @@ -1,10 +1,10 @@ #!/bin/sh set -e -cd /go/src/github.com/lifei6671/mindoc/ +cd /mindoc/ -if [ ! -f "/go/src/github.com/lifei6671/mindoc/conf/app.conf" ] ; then - cp /go/src/github.com/lifei6671/mindoc/conf/app.conf.example /go/src/github.com/lifei6671/mindoc/conf/app.conf +if [ ! -f "/mindoc/conf/app.conf" ] ; then + cp /mindoc/conf/app.conf.example /mindoc/conf/app.conf sed -i "s#^db_adapter=.*#db_adapter=sqlite3#g" conf/app.conf sed -i "s#^db_database.*#db_database=./database/mindoc.db#g" conf/app.conf fi @@ -82,5 +82,5 @@ fi sed -i 's/^runmode.*/runmode=prod/g' conf/app.conf -/go/src/github.com/lifei6671/mindoc/mindoc_linux_amd64 install -/go/src/github.com/lifei6671/mindoc/mindoc_linux_amd64 \ No newline at end of file +/mindoc/mindoc_linux_amd64 install +/mindoc/mindoc_linux_amd64 \ No newline at end of file From e3efe60b7b01a48f6242d56712878cd91757d57b Mon Sep 17 00:00:00 2001 From: ehlxr Date: Wed, 6 Jun 2018 12:09:24 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E7=AB=99=E7=82=B9=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=EF=BC=9A2018-06-06=2012:09:24?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 6243d34e..e12dfcf5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,7 @@ RUN go get -u github.com/golang/dep/cmd/dep && dep ensure && \ CGO_ENABLE=1 go build -v -o mindoc_linux_amd64 -ldflags="-w -X main.VERSION=$TAG -X 'main.BUILD_TIME=`date`' -X 'main.GO_VERSION=`go version`'" && \ rm -rf commands controllers models modules routers tasks vendor docs search data utils graphics .git Godeps uploads/* .gitignore .travis.yml Dockerfile gide.yaml LICENSE main.go README.md conf/enumerate.go conf/mail.go install.lock -FROM nginx:alpine +FROM alpine:latest LABEL maintainer="ehlxr.me@gmail.com" WORKDIR /mindoc COPY --from=0 /go/src/github.com/lifei6671/mindoc .