Skip to content

Commit

Permalink
Adds a UI build in a Docker container. (hashicorp#2462)
Browse files Browse the repository at this point in the history
  • Loading branch information
slackpad authored Nov 2, 2016
1 parent fb7c03c commit 1468930
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 3 deletions.
6 changes: 5 additions & 1 deletion GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
1 change: 0 additions & 1 deletion scripts/consul-builder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion scripts/dist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
18 changes: 18 additions & 0 deletions scripts/ui.sh
Original file line number Diff line number Diff line change
@@ -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 changes: 18 additions & 0 deletions scripts/ui_build.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 1468930

Please sign in to comment.