-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Paul WARD
committed
Nov 13, 2018
0 parents
commit 2f15949
Showing
10 changed files
with
350 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# OSX Specific files | ||
.DS_Store | ||
|
||
# Logs | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Dependency directories | ||
node_modules/ | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
# | ||
# Notes: | ||
# Install Bazel, https://bazel.build/versions/master/docs/install.html#ubuntu | ||
# | ||
FROM openjdk:8 | ||
|
||
# Add an alias for 'll' | ||
RUN echo "alias ll='ls -al'" | tee -a ~/.bashrc | ||
|
||
ENV DEBIAN_FRONTEND noninteractive | ||
RUN echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list \ | ||
&& curl https://bazel.build/bazel-release.pub.gpg | apt-key add - | ||
|
||
RUN apt-get update \ | ||
&& apt-get install --no-install-recommends -y \ | ||
g++ \ | ||
build-essential \ | ||
rsync \ | ||
zip \ | ||
unzip \ | ||
less \ | ||
nano \ | ||
netcat \ | ||
bazel \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Set up workspace | ||
RUN mkdir -p /src | ||
ENV WORKSPACE /src | ||
WORKDIR /src | ||
|
||
#################################### | ||
# Taken from official node image for 8.11.4 at: | ||
# https://github.com/nodejs/docker-node/blob/72dd945d29dee5afa73956ebc971bf3a472442f7/8/stretch/Dockerfile | ||
#################################### | ||
|
||
RUN groupadd --gid 1000 node \ | ||
&& useradd --uid 1000 --gid node --shell /bin/bash --create-home node | ||
|
||
# gpg keys listed at https://github.com/nodejs/node#release-team | ||
RUN set -ex \ | ||
&& for key in \ | ||
94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \ | ||
FD3A5288F042B6850C66B31F09FE44734EB7990E \ | ||
71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \ | ||
DD8F2338BAE7501E3DD5AC78C273792F7D83545D \ | ||
C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \ | ||
B9AE9905FFD7803F25714661B63B535A4C206CA9 \ | ||
56730D5401028683275BD23C23EFEFE93C4CFFFE \ | ||
77984A986EBC2AA786BC0F66B01FBB92821C587A \ | ||
8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600 \ | ||
; do \ | ||
gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" || \ | ||
gpg --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys "$key" || \ | ||
gpg --keyserver hkp://pgp.mit.edu:80 --recv-keys "$key" ; \ | ||
done | ||
|
||
ENV NODE_VERSION 8.11.4 | ||
|
||
RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \ | ||
&& case "${dpkgArch##*-}" in \ | ||
amd64) ARCH='x64';; \ | ||
ppc64el) ARCH='ppc64le';; \ | ||
s390x) ARCH='s390x';; \ | ||
arm64) ARCH='arm64';; \ | ||
armhf) ARCH='armv7l';; \ | ||
i386) ARCH='x86';; \ | ||
*) echo "unsupported architecture"; exit 1 ;; \ | ||
esac \ | ||
&& curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH.tar.xz" \ | ||
&& curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \ | ||
&& gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \ | ||
&& grep " node-v$NODE_VERSION-linux-$ARCH.tar.xz\$" SHASUMS256.txt | sha256sum -c - \ | ||
&& tar -xJf "node-v$NODE_VERSION-linux-$ARCH.tar.xz" -C /usr/local --strip-components=1 --no-same-owner \ | ||
&& rm "node-v$NODE_VERSION-linux-$ARCH.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt \ | ||
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs | ||
|
||
ENV YARN_VERSION 1.10.1 | ||
|
||
RUN set -ex \ | ||
&& for key in \ | ||
6A010C5166006599AA17F08146C2130DFD2497F5 \ | ||
; do \ | ||
gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" || \ | ||
gpg --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys "$key" || \ | ||
gpg --keyserver hkp://pgp.mit.edu:80 --recv-keys "$key" ; \ | ||
done \ | ||
&& curl -fsSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz" \ | ||
&& curl -fsSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz.asc" \ | ||
&& gpg --batch --verify yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \ | ||
&& mkdir -p /opt \ | ||
&& tar -xzf yarn-v$YARN_VERSION.tar.gz -C /opt/ \ | ||
&& ln -s /opt/yarn-v$YARN_VERSION/bin/yarn /usr/local/bin/yarn \ | ||
&& ln -s /opt/yarn-v$YARN_VERSION/bin/yarnpkg /usr/local/bin/yarnpkg \ | ||
&& rm yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz | ||
|
||
RUN yarn global add @bazel/ibazel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Bazel Toy | ||
|
||
For now this only serves public files using ts_devserver. | ||
|
||
The workspace config was taken mostly from [here](https://github.com/bazelbuild/rules_nodejs/pull/217) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
version: "2.1" | ||
|
||
volumes: | ||
bazel_cache: | ||
bazel_repository_cache: | ||
yarn_cache: | ||
|
||
services: | ||
devserver: | ||
build: | ||
context: . | ||
dockerfile: ./Dockerfile | ||
ports: | ||
- 3000:3000 | ||
volumes: | ||
- ./packages:/src | ||
- bazel_cache:/root/.cache/bazel/ | ||
- bazel_repository_cache:/root/.cache/bazel_repository_cache/ | ||
- yarn_cache:/usr/local/share/.cache/yarn/ | ||
working_dir: /src | ||
command: ["/usr/local/bin/ibazel", "run", "//devserver", "--", "--port=3000"] | ||
# command: ["/bin/bash", "-c", "echo \"sleeping indefinitely\"; while true; do sleep 100; done"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
### Paul's notes | ||
### Most of this file was taken from | ||
### https://docs.bazel.build/versions/master/build-javascript.html | ||
### | ||
### Where this file should be placed: | ||
### --------------------------------- | ||
### As of 2018 1111, the link where this file came from incorrectly states that | ||
### this file should be placed into the %workspace%/tools/bazel.rc folder. | ||
### Instead the file should be placed in %workspace%/.bazel per issue #6319 | ||
### https://github.com/bazelbuild/bazel/issues/6319 the file should be | ||
|
||
############################### | ||
# Directory structure # | ||
############################### | ||
|
||
# Globally cache downloaded artifacts. | ||
build --experimental_repository_cache=/root/.cache/bazel_repository_cache/ | ||
test --experimental_repository_cache=/root/.cache/bazel_repository_cache/ | ||
run --experimental_repository_cache=/root/.cache/bazel_repository_cache/ | ||
|
||
# Don't create bazel-* symlinks in the WORKSPACE directory. These | ||
# symlinks require .gitignore and may scare users. Instead, run | ||
# `bazel info bazel-bin` to find out where the outputs are stored. | ||
build --symlink_prefix=/ | ||
|
||
# Another good choice is to create a dist/ directory. Then you can | ||
# use build --symlink_prefix=dist/ to get folders like dist/bin. | ||
# Be aware that this setup will still create a bazel-out symlink in | ||
# your project directory, which you may need to exclude from the | ||
# editor's search path. | ||
|
||
############################### | ||
# Output # | ||
############################### | ||
|
||
# A more useful default output mode for bazel query, which | ||
# prints "ng_module rule //foo:bar" instead of just "//foo:bar". | ||
query --output=label_kind | ||
|
||
# By default, failing tests don't print any output, it's logged to a | ||
# file instead. | ||
test --test_output=errors | ||
|
||
# Show which actions are running under which workers and print all | ||
# the actions running in parallel. This shows that Bazel runs on all | ||
# cores of a CPU. | ||
build --experimental_ui | ||
test --experimental_ui | ||
|
||
############################### | ||
# Typescript / Angular / Sass # | ||
############################### | ||
# Make TypeScript and Angular compilation fast, by keeping a few | ||
# copies of the compiler running as daemons, and cache SourceFile | ||
# ASTs to reduce parse time. | ||
#build --strategy=TypeScriptCompile=worker --strategy=AngularTemplateCompile=worker | ||
|
||
# Enable debugging tests with --config=debug | ||
test:debug --test_arg=--node_options=--inspect-brk --test_output=streamed --test_strategy=exclusive --test_timeout=9999 --nocache_test_results |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
workspace(name = "my_workspace") | ||
|
||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") | ||
|
||
http_archive( | ||
name = "bazel_skylib", | ||
url = "https://github.com/bazelbuild/bazel-skylib/archive/0.3.1.zip", | ||
strip_prefix = "bazel-skylib-0.3.1", | ||
sha256 = "95518adafc9a2b656667bbf517a952e54ce7f350779d0dd95133db4eb5c27fb1", | ||
) | ||
|
||
git_repository( | ||
name = "build_bazel_rules_nodejs", | ||
remote = "https://github.com/bazelbuild/rules_nodejs.git", | ||
tag = "0.15.1", | ||
) | ||
|
||
http_archive( | ||
name = "io_bazel_rules_webtesting", | ||
url = "https://github.com/bazelbuild/rules_webtesting/archive/0.2.1.zip", | ||
strip_prefix = "rules_webtesting-0.2.1", | ||
sha256 = "7d490aadff9b5262e5251fa69427ab2ffd1548422467cb9f9e1d110e2c36f0fa", | ||
) | ||
|
||
http_archive( | ||
name = "io_bazel_rules_go", | ||
url = "https://github.com/bazelbuild/rules_go/releases/download/0.14.0/rules_go-0.14.0.tar.gz", | ||
sha256 = "5756a4ad75b3703eb68249d50e23f5d64eaf1593e886b9aa931aa6e938c4e301", | ||
) | ||
|
||
http_archive( | ||
name = "bazel_gazelle", | ||
urls = ["https://github.com/bazelbuild/bazel-gazelle/releases/download/0.14.0/bazel-gazelle-0.14.0.tar.gz"], | ||
sha256 = "c0a5739d12c6d05b6c1ad56f2200cb0b57c5a70e03ebd2f7b87ce88cabf09c7b", | ||
) | ||
|
||
http_archive( | ||
name = "build_bazel_rules_typescript", | ||
url = "https://github.com/bazelbuild/rules_typescript/archive/0.20.3.zip", | ||
strip_prefix = "rules_typescript-0.20.3", | ||
sha256 = "2a03b23c30c5109ab0863cfa60acce73ceb56337d41efc2dd67f8455a1c1d5f3", | ||
) | ||
|
||
load("@build_bazel_rules_nodejs//:defs.bzl", "node_repositories") | ||
node_repositories( | ||
node_version = "8.11.4", | ||
yarn_version = "1.10.1", | ||
node_repositories = { | ||
"8.11.4-darwin_amd64": ("node-v8.11.4-darwin-x64.tar.gz", "node-v8.11.4-darwin-x64", "aa1de83b388581d0d9ec3276f4526ee67e17e0f1bc0deb5133f960ce5dc9f1ef"), | ||
"8.11.4-linux_amd64": ("node-v8.11.4-linux-x64.tar.xz", "node-v8.11.4-linux-x64", "85ea7cbb5bf624e130585bfe3946e99c85ce5cb84c2aee474038bdbe912f908c"), | ||
"8.11.4-windows_amd64": ("node-v8.11.4-win-x64.zip", "node-v8.11.4-win-x64", "72a21e2fcd3703994f57cf707b92e7f939df99c3e0298102e7436849e4948536"), | ||
}, | ||
yarn_repositories = { | ||
"1.10.1": ("yarn-v1.10.1.tar.gz", "yarn-v1.10.1", "97bf147cb28229e66e4e3c5733a93c851bbcb0f10fbc72696ed011774f4c6f1b"), | ||
}, | ||
node_urls = ["https://nodejs.org/dist/v{version}/{filename}"], | ||
yarn_urls = ["https://github.com/yarnpkg/yarn/releases/download/v{version}/{filename}"], | ||
package_json = ["//:package.json"] | ||
) | ||
|
||
load("@build_bazel_rules_nodejs//:defs.bzl", "yarn_install") | ||
yarn_install( | ||
name = "npm", | ||
package_json = "//:package.json", | ||
yarn_lock = "//:yarn.lock", | ||
) | ||
|
||
load("@io_bazel_rules_go//go:def.bzl", "go_rules_dependencies", "go_register_toolchains") | ||
go_rules_dependencies() | ||
go_register_toolchains() | ||
|
||
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") | ||
gazelle_dependencies() | ||
|
||
load("@io_bazel_rules_webtesting//web:repositories.bzl", "browser_repositories", "web_test_repositories") | ||
web_test_repositories() | ||
browser_repositories( | ||
chromium = True, | ||
) | ||
|
||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_setup_workspace") | ||
ts_setup_workspace() | ||
|
||
# load("//:setup_workspace.bzl", "devserver_example_setup_workspace") | ||
# devserver_example_setup_workspace() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package(default_visibility = ["//visibility:public"]) | ||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_devserver") | ||
|
||
filegroup( | ||
name = "public_files", | ||
srcs = glob( | ||
include = ["public/**/*"], | ||
), | ||
) | ||
|
||
ts_devserver( | ||
name = "devserver", | ||
|
||
# serve these files rooted at / | ||
additional_root_paths = [ | ||
"/my_workspace/devserver/public" | ||
# "npm/node_modules/zone.js/dist", | ||
], | ||
|
||
# # Start from the development version of the main | ||
# entry_module = "angular_bazel_example/src/main.dev", | ||
# scripts = [ | ||
# ":require.config.js", | ||
# ], | ||
# # This is the URL we'll point our <script> tag at | ||
# serving_path = "/bundle.min.js", | ||
# Serve these files in addition to the JavaScript bundle | ||
|
||
static_files = [ | ||
":public_files" | ||
# "@npm//node_modules/zone.js:dist/zone.min.js", | ||
], | ||
|
||
# Tell Bazel to build the sources first | ||
# deps = ["//src"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!DOCTYPE HTML> | ||
|
||
<html> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | ||
<title>Bazel Toy</title> | ||
</head> | ||
<body> | ||
<section> | ||
<article> | ||
<header> | ||
<h2>Bazel Toy</h2> | ||
<p>Lets play with Bazel</p> | ||
</header> | ||
</article> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "packages", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "", | ||
"license": "UNLICENSED", | ||
"devDependencies": { | ||
"@bazel/typescript": "0.20.3", | ||
"@bazel/karma": "0.20.3" | ||
} | ||
} |