Adds a UI build in a Docker container. (#2462)

This commit is contained in:
James Phillips 2016-11-02 15:53:02 -07:00 committed by GitHub
parent cd2194a56d
commit e5210166e2
5 changed files with 42 additions and 3 deletions

View File

@ -59,6 +59,10 @@ vet:
echo "and fix them if necessary before submitting the code for reviewal."; \
fi
# build the static web ui
ui:
@sh -c "'$(CURDIR)/scripts/ui.sh'"
# generates the static web ui that's compiled into the binary
static-assets:
@echo "--> Generating static assets"
@ -69,4 +73,4 @@ static-assets:
tools:
go get -u -v $(GOTOOLS)
.PHONY: all ci bin dev dist cov test cover format vet static-assets tools
.PHONY: all ci bin dev dist cov test cover format vet ui static-assets tools

View File

@ -27,4 +27,3 @@ ENV PATH $GOROOT/bin:$GOPATH/bin:$PATH
RUN mkdir -p $GOPATH/src/github.com/hashicorp/consul
WORKDIR $GOPATH/src/github.com/hashicorp/consul
CMD ./scripts/dist_build.sh

View File

@ -28,7 +28,7 @@ fi
# Do a hermetic build inside a Docker container.
if [ -z $NOBUILD ]; then
docker build -t hashicorp/consul-builder scripts/consul-builder/
docker run --rm -v "$(pwd)":/gopath/src/github.com/hashicorp/consul hashicorp/consul-builder
docker run --rm -v "$(pwd)":/gopath/src/github.com/hashicorp/consul hashicorp/consul-builder ./scripts/dist_build.sh
fi
# Zip all the files.

18
scripts/ui.sh Executable file
View File

@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -e
# Get the parent directory of where this script is.
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
DIR="$( cd -P "$( dirname "$SOURCE" )/.." && pwd )"
# Change into that dir because we expect that.
cd $DIR
# Do a hermetic build inside a Docker container.
if [ -z $NOBUILD ]; then
docker build -t hashicorp/consul-builder scripts/consul-builder/
docker run --rm -v "$(pwd)":/gopath/src/github.com/hashicorp/consul hashicorp/consul-builder ./scripts/ui_build.sh
fi
exit 0

18
scripts/ui_build.sh Executable file
View File

@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -e
# Get the parent directory of where this script is.
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
DIR="$( cd -P "$( dirname "$SOURCE" )/.." && pwd )"
# Change into that dir because we expect that.
cd $DIR
# Build the web assets.
pushd ui
bundle
make dist
popd
exit 0