From 5eb1b218227804f8350226890586f36dd8b39ed1 Mon Sep 17 00:00:00 2001 From: Erik Wilson Date: Fri, 28 Feb 2020 15:39:11 -0700 Subject: [PATCH] Clean up building && provide Vagrant centos7 setup --- Dockerfile.dapper | 10 +-- Vagrantfile | 70 ++++++---------- scripts/build | 4 +- .../generic/alpine310/vagrant} | 54 ++++--------- scripts/provision/generic/centos7/vagrant | 79 +++++++++++++++++++ scripts/provision/vagrant | 55 +++++++++++++ 6 files changed, 182 insertions(+), 90 deletions(-) rename scripts/{vagrant-provision => provision/generic/alpine310/vagrant} (60%) create mode 100755 scripts/provision/generic/centos7/vagrant create mode 100755 scripts/provision/vagrant diff --git a/Dockerfile.dapper b/Dockerfile.dapper index ed23921724..b990537d15 100644 --- a/Dockerfile.dapper +++ b/Dockerfile.dapper @@ -1,13 +1,13 @@ FROM golang:1.13.8-alpine3.10 RUN apk -U --no-cache add bash git gcc musl-dev docker vim less file curl wget ca-certificates jq linux-headers zlib-dev tar zip squashfs-tools npm coreutils \ - python2 python3 py3-pip python3-dev openssl-dev libffi-dev libseccomp libseccomp-dev make libuv-static -RUN pip3 install 'tox==3.6.0' + python2 openssl-dev libffi-dev libseccomp libseccomp-dev make libuv-static + RUN apk -U --no-cache --repository http://dl-3.alpinelinux.org/alpine/edge/main/ add sqlite-dev sqlite-static libselinux libselinux-dev RUN mkdir -p /go/src/golang.org/x && \ - cd /go/src/golang.org/x && git clone https://github.com/golang/tools && \ - git -C /go/src/golang.org/x/tools checkout -b current aa82965741a9fecd12b026fbb3d3c6ed3231b8f8 && \ - go install golang.org/x/tools/cmd/goimports + cd /go/src/golang.org/x && git clone https://github.com/golang/tools && cd tools && \ + git checkout -b current aa82965741a9fecd12b026fbb3d3c6ed3231b8f8 && \ + go install golang.org/x/tools/cmd/goimports && cd RUN rm -rf /go/src /go/pkg ARG DAPPER_HOST_ARCH diff --git a/Vagrantfile b/Vagrantfile index 8a962e3656..57f8b57da2 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,12 +1,14 @@ -BOX = "generic/alpine310" +OS = (ENV['OS'] || "alpine310") +BOX_REPO = (ENV['BOX_REPO'] || "generic") +BOX = (ENV['BOX'] || "#{BOX_REPO}/#{OS}") HOME = File.dirname(__FILE__) PROJECT = File.basename(HOME) -MOUNT_TYPE = ENV['MOUNT_TYPE'] || "nfs" NUM_NODES = (ENV['NUM_NODES'] || 0).to_i NODE_CPUS = (ENV['NODE_CPUS'] || 4).to_i NODE_MEMORY = (ENV['NODE_MEMORY'] || 8192).to_i NETWORK_PREFIX = ENV['NETWORK_PREFIX'] || "10.135.135" -VAGRANT_PROVISION = ENV['VAGRANT_PROVISION'] || "./scripts/vagrant-provision" +VAGRANT_PROVISION = ENV['VAGRANT_PROVISION'] || "./scripts/provision/vagrant" +MOUNT_TYPE = ENV['MOUNT_TYPE'] || "nfs" # --- Rules for /etc/sudoers to avoid password entry configuring NFS: # %admin ALL = (root) NOPASSWD: /usr/bin/sed -E -e * -ibak /etc/exports @@ -14,43 +16,14 @@ VAGRANT_PROVISION = ENV['VAGRANT_PROVISION'] || "./scripts/vagrant-provision" # %admin ALL = (root) NOPASSWD: /sbin/nfsd restart # --- May need to add terminal to System Preferences -> Security & Privacy -> Privacy -> Full Disk Access -# --- Check for missing plugins -required_plugins = %w( vagrant-alpine vagrant-timezone ) -plugin_installed = false -required_plugins.each do |plugin| - unless Vagrant.has_plugin?(plugin) - system "vagrant plugin install #{plugin}" - plugin_installed = true - end -end -# --- If new plugins installed, restart Vagrant process -if plugin_installed === true - exec "vagrant #{ARGV.join' '}" +def provision(vm) + vm.provision "shell", + path: VAGRANT_PROVISION, + env: { 'HOME' => HOME, 'GOPATH' => ENV['GOPATH'], 'BOX' => vm.box } end -provision = <