This commit is contained in:
Tan Jiang 2016-04-07 18:34:12 +08:00
parent e3c0e4b999
commit 42c398fac8
4 changed files with 13 additions and 13 deletions

View File

@ -36,7 +36,9 @@ services:
syslog-address: "tcp://127.0.0.1:1514" syslog-address: "tcp://127.0.0.1:1514"
syslog-tag: "mysql" syslog-tag: "mysql"
ui: ui:
build: ../ build:
context: ../
dockerfile: Dockerfile.ui
env_file: env_file:
- ./config/ui/env - ./config/ui/env
volumes: volumes:

View File

@ -9,30 +9,28 @@ RUN apt-get update \
COPY . /go/src/github.com/vmware/harbor COPY . /go/src/github.com/vmware/harbor
#golang.org is blocked in China #golang.org is blocked in China
COPY ./vendor/golang.org /go/src/golang.org COPY ./vendor/golang.org /go/src/golang.org
WORKDIR /go/src/github.com/vmware/harbor WORKDIR /go/src/github.com/vmware/harbor/ui
ENV GO15VENDOREXPERIMENT 1 ENV GO15VENDOREXPERIMENT 1
RUN go get -d github.com/docker/distribution \ RUN go get -d github.com/docker/distribution \
&& go get -d github.com/docker/libtrust \ && go get -d github.com/docker/libtrust \
&& go get -d github.com/go-sql-driver/mysql \ && go get -d github.com/go-sql-driver/mysql \
&& go install -v -a && go build -v -a -o /go/bin/harbor_ui
ENV MYSQL_USR root \ ENV MYSQL_USR root \
MYSQL_PWD root \ MYSQL_PWD root \
MYSQL_PORT_3306_TCP_ADDR localhost \
MYSQL_PORT_3306_TCP_PORT 3306 \
REGISTRY_URL localhost:5000 REGISTRY_URL localhost:5000
COPY views /go/bin/views COPY views /go/bin/views
COPY static /go/bin/static COPY static /go/bin/static
COPY favicon.ico /go/bin/favicon.ico COPY favicon.ico /go/bin/favicon.ico
RUN chmod u+x /go/bin/harbor \ RUN chmod u+x /go/bin/harbor_ui \
&& sed -i 's/TLS_CACERT/#TLS_CAERT/g' /etc/ldap/ldap.conf \ && sed -i 's/TLS_CACERT/#TLS_CAERT/g' /etc/ldap/ldap.conf \
&& sed -i '$a\TLS_REQCERT allow' /etc/ldap/ldap.conf && sed -i '$a\TLS_REQCERT allow' /etc/ldap/ldap.conf
WORKDIR /go/bin/ WORKDIR /go/bin/
ENTRYPOINT ["/go/bin/harbor"] ENTRYPOINT ["/go/bin/harbor_ui"]
EXPOSE 80 EXPOSE 80

View File

@ -24,7 +24,6 @@ import (
_ "github.com/vmware/harbor/auth/ldap" _ "github.com/vmware/harbor/auth/ldap"
"github.com/vmware/harbor/dao" "github.com/vmware/harbor/dao"
"github.com/vmware/harbor/models" "github.com/vmware/harbor/models"
_ "github.com/vmware/harbor/routers"
"os" "os"
@ -71,5 +70,6 @@ func main() {
if err := updateInitPassword(adminUserID, os.Getenv("HARBOR_ADMIN_PASSWORD")); err != nil { if err := updateInitPassword(adminUserID, os.Getenv("HARBOR_ADMIN_PASSWORD")); err != nil {
log.Error(err) log.Error(err)
} }
initRouters()
beego.Run() beego.Run()
} }

View File

@ -13,7 +13,7 @@
limitations under the License. limitations under the License.
*/ */
package routers package main
import ( import (
"github.com/vmware/harbor/api" "github.com/vmware/harbor/api"
@ -23,11 +23,11 @@ import (
"github.com/astaxie/beego" "github.com/astaxie/beego"
) )
func init() { func initRouters() {
beego.SetStaticPath("registry/static/i18n", "static/i18n") beego.SetStaticPath("registry/static/i18n", "/static/i18n")
beego.SetStaticPath("registry/static/resources", "static/resources") beego.SetStaticPath("registry/static/resources", "/static/resources")
beego.SetStaticPath("registry/static/vendors", "static/vendors") beego.SetStaticPath("registry/static/vendors", "/static/vendors")
beego.Router("/login", &controllers.CommonController{}, "post:Login") beego.Router("/login", &controllers.CommonController{}, "post:Login")
beego.Router("/logout", &controllers.CommonController{}, "get:Logout") beego.Router("/logout", &controllers.CommonController{}, "get:Logout")