feat: build static file in global process

- Create a webui DockerFile
- add task `generate-webui`
- use task `generate-webui` in build process
This commit is contained in:
Fernandez Ludovic 2016-01-20 22:45:51 +01:00
parent faa7fd0f05
commit 5bfcfeb779
4 changed files with 34 additions and 4 deletions

View file

@ -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

View file

@ -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

18
webui/Dockerfile Normal file
View file

@ -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

View file

@ -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)