Migrate NPM to Yarn (#1197)

- Modify `make deps` to use yarn
- Add `yarn.lock`
- Add yarn to `kolide-builder` docker image
- Remove `npm-shrinkwrap.json`
- Remove build for `node-sass` (fixes #1151)
This commit is contained in:
Zachary Wasserman 2017-02-10 10:22:26 -08:00 committed by GitHub
parent f0f40d3168
commit f4060402f4
12 changed files with 6346 additions and 5525 deletions

View File

@ -143,8 +143,7 @@ generate-dev: .prefix
webpack --progress --colors --watch --notify
deps:
npm install --no-optional
npm shrinkwrap
yarn
go get github.com/jteeuwen/go-bindata/...
go get github.com/Masterminds/glide
go get github.com/groob/mockimpl

View File

@ -24,13 +24,13 @@ dependencies:
- "/opt/google-cloud-sdk"
override:
- docker run -v $(pwd):/go/src/github.com/kolide/kolide -v /home/ubuntu/.go_workspace/pkg:/go/pkg kolide/kolide-builder:1.8 --deps
- docker run -v $(pwd):/go/src/github.com/kolide/kolide -v /home/ubuntu/.go_workspace/pkg:/go/pkg kolide/kolide-builder:1.8-yarn --deps
test:
override:
- docker run -d --name redis redis
- docker run -d --name mysql -e MYSQL_ROOT_PASSWORD=toor -e MYSQL_DATABASE=kolide -e MYSQL_USER=kolide -e MYSQL_PASSWORD=kolide mysql:5.7
- docker run --link redis:redis --link mysql:mysql -e MYSQL_TEST=true -e REDIS_TEST=true -v $(pwd):/go/src/github.com/kolide/kolide -v /home/ubuntu/.go_workspace/pkg:/go/pkg kolide/kolide-builder:1.8 --build
- docker run --link redis:redis --link mysql:mysql -e MYSQL_TEST=true -e REDIS_TEST=true -v $(pwd):/go/src/github.com/kolide/kolide -v /home/ubuntu/.go_workspace/pkg:/go/pkg kolide/kolide-builder:1.8-yarn --build
- docker stop $(docker ps -a -q)
deployment:

View File

@ -6,7 +6,7 @@ Building The Code
To setup a working local development environment, you must install the following minimum toolset:
* [Go](https://golang.org/dl/) (1.8 or greater)
* [Node.js](https://nodejs.org/en/download/current/) (and npm)
* [Node.js](https://nodejs.org/en/download/current/) and [Yarn](https://yarnpkg.com/en/docs/install)
* [GNU Make](https://www.gnu.org/software/make/)
* [Docker](https://www.docker.com/products/overview#/install_the_platform)

5464
npm-shrinkwrap.json generated

File diff suppressed because it is too large Load Diff

View File

@ -24,6 +24,7 @@
"babel-preset-react": "6.11.1",
"babel-preset-react-hmre": "1.1.1",
"babel-preset-stage-0": "6.5.0",
"bourbon": "~4.2.7",
"brace": "^0.8.0",
"classnames": "^2.2.5",
"css-loader": "^0.23.1",
@ -47,7 +48,7 @@
"moment": "^2.15.1",
"nock": "^8.0.0",
"node-bourbon": "^4.2.8",
"node-sass": "^3.10.1",
"node-sass": "^4.5.0",
"normalizr": "^2.2.1",
"postcss-functions": "^2.1.0",
"postcss-loader": "^0.8.0",

View File

@ -1,10 +1,6 @@
FROM golang:1.8-alpine
MAINTAINER Kolide Developers <engineering@kolide.co>
# path to compiled version of node-sass for alpine
# https://github.com/sass/node-sass/issues/1589
ENV SASS_BINARY_PATH=/linux-x64-48_binding.node
RUN apk add --update \
git \
nodejs \
@ -13,9 +9,14 @@ RUN apk add --update \
musl-dev \
openssl
RUN \
go get -u -v github.com/Masterminds/glide && \
go get -u -v gopkg.in/alecthomas/gometalinter.v1
RUN go get -u -v github.com/Masterminds/glide
RUN echo -e 'http://dl-cdn.alpinelinux.org/alpine/edge/main\nhttp://dl-cdn.alpinelinux.org/alpine/edge/community\nhttp://dl-cdn.alpinelinux.org/alpine/edge/testing' > /etc/apk/repositories && \
apk add --no-cache yarn
# git must be explicitly instructed to follow redirects for compatibility with
# gopkg.in
RUN git config --global http.https://gopkg.in.followRedirects true
COPY rootfs /
@ -25,4 +26,3 @@ WORKDIR /go/src/github.com/kolide/kolide
EXPOSE 8080
ENTRYPOINT ["/builder.sh"]

View File

@ -1,25 +1,18 @@
.PHONY: build node-sass kolide-builder push
.PHONY: build kolide-builder push
GO_VERSION = 1.8
all: clean build
build: node-sass kolide-builder
node-sass:
mkdir -p build
cd alpine-node-sass && \
docker build -t node-sass-builder . && \
docker run -v $(shell pwd)/build:/build node-sass-builder && cd ..
build: kolide-builder
kolide-builder:
# copy node-sass artifacts into rootfs
cp build/* $(GO_VERSION)/rootfs/
cd $(GO_VERSION) && \
docker build -t kolide/kolide-builder:$(GO_VERSION) .
docker build -t kolide/kolide-builder:$(GO_VERSION)-yarn .
push:
docker push kolide/kolide-builder:$(GO_VERSION)
docker push kolide/kolide-builder:$(GO_VERSION)-yarn
clean:
clean:
rm -rf build

View File

@ -1,11 +0,0 @@
FROM mhart/alpine-node:latest
ENV NODE_SASS_VERSION=v3.10.0
RUN apk --update add \
git \
build-base \
perl \
python
COPY build.sh build.sh
CMD ["/build.sh"]

View File

@ -1 +0,0 @@
Builds alpine bindings for node-sass

View File

@ -1,20 +0,0 @@
#!/bin/sh
REV="${NODE_SASS_VERSION:-master}"
echo "Building node-sass $REV"
# clone and build the node-sass version
git clone --recursive https://github.com/sass/node-sass.git
cd node-sass
git checkout $REV
git submodule update --init --recursive
npm install
node scripts/build -f
# rename and move /node-sass/vendor/linux-x64-*/binding.node
# to /build/$REV/linux-x64-version_binding.node
mkdir -p /build
cd vendor
for file in $(find . -type f); do
RENAME=$(echo "$file" | awk 'BEGIN { FS = "/" } ; {print $2"_"$3}')
cp $file "/build/$RENAME"
done

View File

@ -9,8 +9,8 @@ docker_pull() {
local_image="/home/ubuntu/deps/$1.tar"
remote_image=$2
if [[ -e $local_image ]]; then
docker load -i $local_image;
if [[ -e $local_image ]]; then
docker load -i $local_image;
else
docker pull "${remote_image}"
docker save "${remote_image}" > "${local_image}"
@ -27,7 +27,7 @@ curl_binary() {
fi
}
docker_pull "kolide_builder" "kolide/kolide-builder:1.8"
docker_pull "kolide_builder" "kolide/kolide-builder:1.8-yarn"
docker_pull "redis" "redis"
docker_pull "mysql" "mysql:5.7"
docker_pull "fpm" "kolide/fpm"

6324
yarn.lock Normal file

File diff suppressed because it is too large Load Diff