From 5bfcfeb779535b344d2487f3dfed06c11b57c956 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Wed, 20 Jan 2016 22:45:51 +0100 Subject: [PATCH] feat: build static file in global process - Create a webui DockerFile - add task `generate-webui` - use task `generate-webui` in build process --- Makefile | 8 ++++++-- README.md | 4 ++-- webui/Dockerfile | 18 ++++++++++++++++++ webui/readme.md | 8 ++++++++ 4 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 webui/Dockerfile diff --git a/Makefile b/Makefile index 91e11c604..191331eb9 100644 --- a/Makefile +++ b/Makefile @@ -24,10 +24,10 @@ default: binary all: build $(DOCKER_RUN_TRAEFIK) ./script/make.sh -binary: build +binary: build generate-webui $(DOCKER_RUN_TRAEFIK) ./script/make.sh generate binary -crossbinary: build +crossbinary: build generate-webui $(DOCKER_RUN_TRAEFIK) ./script/make.sh generate crossbinary test: build @@ -52,6 +52,7 @@ validate-golint: build $(DOCKER_RUN_TRAEFIK) ./script/make.sh validate-golint build: dist + docker build -t traefik-webui -f webui/Dockerfile webui docker build -t "$(TRAEFIK_DEV_IMAGE)" -f build.Dockerfile . build-no-cache: dist @@ -70,3 +71,6 @@ run-dev: go generate go build ./traefik + +generate-webui: + docker run --rm -v "$$PWD/static":'/src/static' traefik-webui gulp build diff --git a/README.md b/README.md index 8704f7004..cbb34d536 100644 --- a/README.md +++ b/README.md @@ -83,6 +83,7 @@ Refer to the [benchmarks section](docs/index.md#benchmarks) in the documentation You need either [Docker](https://github.com/docker/docker) and `make`, or `go` and `glide` in order to build traefik. #### Setting up your `go` environment + - You need `go` v1.5 - You need to set `export GO15VENDOREXPERIMENT=1` environment variable - You need `go-bindata` to be able to use `go generate` command (needed to build) : `go get github.com/jteeuwen/go-bindata/...`. @@ -90,8 +91,7 @@ You need either [Docker](https://github.com/docker/docker) and `make`, or `go` a #### Using `Docker` and `Makefile` -You need to run the `binary` target. This will create binaries for -linux platform in the `dist` folder. +You need to run the `binary` target. This will create binaries for Linux platform in the `dist` folder. ```bash $ make binary diff --git a/webui/Dockerfile b/webui/Dockerfile new file mode 100644 index 000000000..196da1d7d --- /dev/null +++ b/webui/Dockerfile @@ -0,0 +1,18 @@ +FROM node:5.4 + +ENV WEBUI_DIR /src/webui +RUN mkdir -p $WEBUI_DIR + +RUN npm install -g gulp bower + +COPY package.json $WEBUI_DIR/ +COPY .bowerrc $WEBUI_DIR/ +COPY bower.json $WEBUI_DIR/ + +WORKDIR $WEBUI_DIR +RUN npm install +RUN bower install --allow-root + +COPY . $WEBUI_DIR/ + +EXPOSE 3000 3001 8080 diff --git a/webui/readme.md b/webui/readme.md index 6e6ede9d8..33a683386 100644 --- a/webui/readme.md +++ b/webui/readme.md @@ -8,6 +8,14 @@ Træfɪk Web UI provide 2 types of informations: - Providers with their backends and frontends information. - Health of the web server. +## How to build (for backends developer) + +Use the make file : + +```shell +make build # Generate Docker image +make generate-webui # Generate static contents in `traefik/static/` folder. +``` ## How to build (only for frontends developer)