Merge pull request #1847 from hashicorp/sethvargo/container
Move to container-based build process
This commit is contained in:
commit
4e95dac9bc
|
@ -63,12 +63,6 @@ vet:
|
||||||
echo "[LINT] Found "log"".Printf" calls. These should use Nomad's logger instead."; \
|
echo "[LINT] Found "log"".Printf" calls. These should use Nomad's logger instead."; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
web:
|
|
||||||
./scripts/website_run.sh
|
|
||||||
|
|
||||||
web-push:
|
|
||||||
./scripts/website_push.sh
|
|
||||||
|
|
||||||
# bootstrap the build by downloading additional tools
|
# bootstrap the build by downloading additional tools
|
||||||
bootstrap:
|
bootstrap:
|
||||||
@for tool in $(EXTERNAL_TOOLS) ; do \
|
@for tool in $(EXTERNAL_TOOLS) ; do \
|
||||||
|
@ -82,4 +76,4 @@ install: bin/nomad
|
||||||
travis:
|
travis:
|
||||||
@sh -c "'$(PWD)/scripts/travis.sh'"
|
@sh -c "'$(PWD)/scripts/travis.sh'"
|
||||||
|
|
||||||
.PHONY: all bin cov integ test vet web web-push test-nodep
|
.PHONY: all bin cov integ test vet test-nodep
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
source "https://rubygems.org"
|
source "https://rubygems.org"
|
||||||
|
|
||||||
gem "middleman-hashicorp"
|
gem "middleman-hashicorp", "0.3.3"
|
||||||
|
|
|
@ -7,7 +7,7 @@ GEM
|
||||||
minitest (~> 5.1)
|
minitest (~> 5.1)
|
||||||
thread_safe (~> 0.3, >= 0.3.4)
|
thread_safe (~> 0.3, >= 0.3.4)
|
||||||
tzinfo (~> 1.1)
|
tzinfo (~> 1.1)
|
||||||
autoprefixer-rails (6.5.0.2)
|
autoprefixer-rails (6.5.1)
|
||||||
execjs
|
execjs
|
||||||
bootstrap-sass (3.3.7)
|
bootstrap-sass (3.3.7)
|
||||||
autoprefixer-rails (>= 5.2.1)
|
autoprefixer-rails (>= 5.2.1)
|
||||||
|
@ -78,7 +78,7 @@ GEM
|
||||||
rack (>= 1.4.5, < 2.0)
|
rack (>= 1.4.5, < 2.0)
|
||||||
thor (>= 0.15.2, < 2.0)
|
thor (>= 0.15.2, < 2.0)
|
||||||
tilt (~> 1.4.1, < 2.0)
|
tilt (~> 1.4.1, < 2.0)
|
||||||
middleman-hashicorp (0.3.0)
|
middleman-hashicorp (0.3.3)
|
||||||
bootstrap-sass (~> 3.3)
|
bootstrap-sass (~> 3.3)
|
||||||
builder (~> 3.2)
|
builder (~> 3.2)
|
||||||
middleman (~> 3.4)
|
middleman (~> 3.4)
|
||||||
|
@ -148,7 +148,7 @@ PLATFORMS
|
||||||
ruby
|
ruby
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
middleman-hashicorp
|
middleman-hashicorp (= 0.3.3)
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
1.13.1
|
1.13.5
|
||||||
|
|
|
@ -1,10 +1,14 @@
|
||||||
all: build
|
VERSION?="0.3.3"
|
||||||
|
|
||||||
init:
|
website:
|
||||||
bundle
|
@echo "==> Starting website in Docker..."
|
||||||
|
@docker run \
|
||||||
|
--interactive \
|
||||||
|
--rm \
|
||||||
|
--tty \
|
||||||
|
--publish "4567:4567" \
|
||||||
|
--publish "35729:35729" \
|
||||||
|
--volume "$(shell pwd):/website" \
|
||||||
|
hashicorp/middleman-hashicorp:${VERSION}
|
||||||
|
|
||||||
dev: init
|
.PHONY :website
|
||||||
bundle exec middleman server
|
|
||||||
|
|
||||||
build: init
|
|
||||||
bundle exec middleman build
|
|
||||||
|
|
|
@ -12,7 +12,19 @@ requests like any normal GitHub project, and we'll merge it in.
|
||||||
|
|
||||||
## Running the Site Locally
|
## Running the Site Locally
|
||||||
|
|
||||||
Running the site locally is simple. Clone this repo and run `make dev`.
|
To run the site locally, clone this repository and run:
|
||||||
|
|
||||||
Then open up `http://localhost:4567`. Note that some URLs you may need to append
|
```shell
|
||||||
".html" to make them work (in the navigation).
|
$ make website
|
||||||
|
```
|
||||||
|
|
||||||
|
You must have Docker installed for this to work.
|
||||||
|
|
||||||
|
Alternatively, you can manually run the website like this:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ bundle
|
||||||
|
$ bundle exec middleman server
|
||||||
|
```
|
||||||
|
|
||||||
|
Then open up `http://localhost:4567`.
|
||||||
|
|
|
@ -1,41 +0,0 @@
|
||||||
# -*- mode: ruby -*-
|
|
||||||
# vi: set ft=ruby :
|
|
||||||
|
|
||||||
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
|
|
||||||
VAGRANTFILE_API_VERSION = "2"
|
|
||||||
|
|
||||||
$script = <<SCRIPT
|
|
||||||
sudo apt-get -y update
|
|
||||||
|
|
||||||
# RVM/Ruby
|
|
||||||
sudo apt-get -y install curl git
|
|
||||||
curl -sSL https://rvm.io/mpapis.asc | gpg --import -
|
|
||||||
curl -sSL https://get.rvm.io | bash -s stable
|
|
||||||
. ~/.bashrc
|
|
||||||
. ~/.bash_profile
|
|
||||||
rvm install 2.2.2
|
|
||||||
rvm --default use 2.2.2
|
|
||||||
gem install bundler
|
|
||||||
|
|
||||||
# Middleman deps
|
|
||||||
cd /vagrant
|
|
||||||
bundle
|
|
||||||
|
|
||||||
# JS stuff
|
|
||||||
sudo apt-get install -y python-software-properties
|
|
||||||
sudo add-apt-repository -y ppa:chris-lea/node.js
|
|
||||||
sudo apt-get update -y
|
|
||||||
sudo apt-get install -y nodejs
|
|
||||||
|
|
||||||
# Get JS deps
|
|
||||||
# cd /vagrant/source
|
|
||||||
# npm install
|
|
||||||
SCRIPT
|
|
||||||
|
|
||||||
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
|
||||||
config.vm.box = "bento/ubuntu-12.04"
|
|
||||||
config.vm.network "private_network", ip: "33.33.30.10"
|
|
||||||
config.vm.network "forwarded_port", guest: 4567, host: 8080
|
|
||||||
config.vm.provision "shell", inline: $script, privileged: false
|
|
||||||
config.vm.synced_folder ".", "/vagrant"
|
|
||||||
end
|
|
|
@ -8,15 +8,16 @@
|
||||||
"builders": [
|
"builders": [
|
||||||
{
|
{
|
||||||
"type": "docker",
|
"type": "docker",
|
||||||
"image": "ruby:2.3-slim",
|
"image": "hashicorp/middleman-hashicorp:0.3.3",
|
||||||
"commit": "true"
|
"discard": "true",
|
||||||
|
"run_command": ["-d", "-i", "-t", "{{ .Image }}", "/bin/sh"]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"provisioners": [
|
"provisioners": [
|
||||||
{
|
{
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"source": ".",
|
"source": ".",
|
||||||
"destination": "/app"
|
"destination": "/website"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
|
@ -27,16 +28,9 @@
|
||||||
"FASTLY_API_KEY={{ user `fastly_api_key` }}"
|
"FASTLY_API_KEY={{ user `fastly_api_key` }}"
|
||||||
],
|
],
|
||||||
"inline": [
|
"inline": [
|
||||||
"apt-get -qq update",
|
"bundle check || bundle install",
|
||||||
"apt-get -yqq install build-essential curl git libffi-dev wget",
|
|
||||||
"apt-get -yqq install python-pip",
|
|
||||||
"pip install s3cmd",
|
|
||||||
"cd /app",
|
|
||||||
|
|
||||||
"bundle check || bundle install --jobs 7",
|
|
||||||
"bundle exec middleman build",
|
"bundle exec middleman build",
|
||||||
|
"/bin/sh ./scripts/deploy.sh"
|
||||||
"/bin/bash ./scripts/deploy.sh"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
PROJECT="nomad"
|
PROJECT="nomad"
|
||||||
|
@ -28,11 +28,8 @@ if ! command -v "s3cmd" >/dev/null 2>&1; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get the parent directory of where this script is and change into our website
|
# Get the parent directory of where this script is and cd there
|
||||||
# directory
|
DIR="$(cd "$(dirname "$(readlink -f "$0")")/.." && pwd)"
|
||||||
SOURCE="${BASH_SOURCE[0]}"
|
|
||||||
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
|
|
||||||
DIR="$(cd -P "$( dirname "$SOURCE" )/.." && pwd)"
|
|
||||||
|
|
||||||
# Delete any .DS_Store files for our OS X friends.
|
# Delete any .DS_Store files for our OS X friends.
|
||||||
find "$DIR" -type f -name '.DS_Store' -delete
|
find "$DIR" -type f -name '.DS_Store' -delete
|
||||||
|
@ -106,6 +103,13 @@ fi
|
||||||
# Warm the cache with recursive wget.
|
# Warm the cache with recursive wget.
|
||||||
if [ -z "$NO_WARM" ]; then
|
if [ -z "$NO_WARM" ]; then
|
||||||
echo "Warming Fastly cache..."
|
echo "Warming Fastly cache..."
|
||||||
|
echo ""
|
||||||
|
echo "If this step fails, there are likely missing or broken assets or links"
|
||||||
|
echo "on the website. Run the following command manually on your laptop, and"
|
||||||
|
echo "search for \"ERROR\" in the output:"
|
||||||
|
echo ""
|
||||||
|
echo "wget --recursive --delete-after https://$PROJECT_URL/"
|
||||||
|
echo ""
|
||||||
wget \
|
wget \
|
||||||
--recursive \
|
--recursive \
|
||||||
--delete-after \
|
--delete-after \
|
||||||
|
|
Loading…
Reference in New Issue