Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerfile: add docker build. #42

Merged
merged 2 commits into from
Dec 9, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,32 @@ This will pull the dependencies, build the runtime and all the
utilities, run a number of tests in either Firefox or Chrome, and then
launch a copy of the shell served locally.

`Dockerfile`
-----------

```sh
$ ./docker/build.sh
....
root@3695ed0cdf45:~/browsix# make test-once serve
TEST
[13:07:00] Using gulpfile ~/browsix/gulpfile.js
[13:07:00] Starting 'copy-node-kernel'...
[13:07:00] Starting 'copy-node'...
[13:07:00] Starting 'lint-kernel'...
[13:07:00] Starting 'lint-browser-node'...
[13:07:00] Starting 'lint-bin'...
[13:07:00] Starting 'lint-syscall-api'...
[13:07:00] Finished 'copy-node-kernel' after 82 ms
[13:07:02] Finished 'lint-syscall-api' after 1.61 s
[13:07:04] Finished 'lint-kernel' after 3.72 s
[13:07:05] Finished 'lint-browser-node' after 4.46 s
[13:07:05] Finished 'lint-bin' after 5.08 s
[13:07:05] Starting 'build-bin'...
[13:07:06] Finished 'copy-node' after 5.16 s
[13:07:06] Starting 'build-kernel'...
[13:07:06] Starting 'build-browser-node'...
...
```

In-browser node limitations
---------------------------
Expand Down
161 changes: 161 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
FROM ubuntu:14.04

SHELL ["/bin/bash", "-c"]
ENV DEBIAN_FRONTEND noninteractive
# ENV DEBIAN_FRONTEND newt
ENV CLICOLOR=1
ENV LSCOLORS=GxFxCxDxBxegedabagaced
ENV GREP_OPTIONS='--color=auto'

RUN \
echo America/Los_Angeles | sudo tee /etc/timezone && \
sudo dpkg-reconfigure --frontend noninteractive tzdata

RUN \
apt-get update -qq -y && \
apt-get upgrade -qq -y

RUN apt-get install -qq -y \
software-properties-common \
vim \
curl \
wget \
gawk \
sed \
findutils \
bc \
less \
htop \
man \
unzip \
git \
lsb-release \
build-essential \
make \
python-all \
libssl-dev

RUN apt-get install -qq -y \
openssh-server

ENV HOME /root
ENV NVM_DIR $HOME/.nvm
ENV NODE_VERSION v4.3.0
ENV YARN_VERSION 0.17.8

RUN wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | /bin/bash
RUN source $NVM_DIR/nvm.sh; \
nvm install $NODE_VERSION && \
nvm alias default $NODE_VERSION && \
nvm use default

RUN apt-get install -qq -y \
ca-certificates \
g++ \
gcc \
libc6-dev \
curl \
mercurial \
bzr \
git-core

ENV GOLANG_VERSION 1.7.4
ENV GOLANG_DOWNLOAD_URL https://storage.googleapis.com/golang/go$GOLANG_VERSION.linux-amd64.tar.gz

RUN curl -s $GOLANG_DOWNLOAD_URL | tar -C /usr/local -xz

ENV GOPATH /go
ENV GOROOT /usr/local/go
ENV PATH /usr/local/go/bin:/go/bin:/usr/local/bin:$PATH

RUN go get -u -x -v -a github.com/gopherjs/gopherjs

RUN \
source $NVM_DIR/nvm.sh; \
echo "nvm: " `nvm --version` && \
echo "node: " `node --version` && \
echo "npm: " `npm --version` && \
npm install -g \
gulp@"^3.9.1" \
bower@"^1.7.9" \
source-map-support

RUN echo -e \
'{'\
'\n'\
' "allow_root": true'\
'\n'\
'}' \
>> $HOME/.bowerrc

RUN cat $HOME/.bowerrc

RUN \
source $NVM_DIR/nvm.sh; \
npm install -g \
bfs-buffer@"^0.1.7" \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did all of these come from the package.json? Is it possible to COPY that in and install off of it, or otherwise auto-generate this?

bfs-path@"^0.1.2" \
bower@"^1.7.9" \
browser-sync@"^2.13.0" \
browserfs-browsix-tmp@"0.5.15" \
browserify@"^13.0.1" \
chai@"^3.5.0" \
connect-history-api-fallback@"^1.1.0" \
del@"^2.2.1" \
gulp@"^3.9.1" \
gulp-autoprefixer@"^3.1.0" \
gulp-cache@"^0.4.5" \
gulp-changed@"^1.3.0" \
gulp-chmod@"^1.3.0" \
gulp-copy@"0.0.2" \
gulp-cssmin@"^0.1.7" \
gulp-if@"^2.0.0" \
gulp-load-plugins@"^1.2.0" \
gulp-minify-html@"^1.0.5" \
gulp-mocha@"^2.2.0" \
gulp-rename@"^1.2.2" \
gulp-replace@"^0.5.4" \
gulp-run@"^1.6.12" \
gulp-size@"^2.0.0" \
gulp-typescript@"2.13.6" \
gulp-uglify@"^1.5.4" \
gulp-useref@"^2.1.0" \
gulp-util@"^3.0.6" \
gulp-vulcanize@"^6.1.0" \
karma@"^1.1.1" \
karma-chai@"^0.1.0" \
karma-chrome-launcher@"^1.0.1" \
karma-firefox-launcher@"^1.0.0" \
karma-mocha@"^1.1.1" \
merge2@"^1.0.0" \
mocha@"^2.5.3" \
proxy-middleware@"^0.15.0" \
through2@"^2.0.1" \
typescript@"^1.8.10" \
typings@"^1.3.1" \
vinyl-buffer@"^1.0.0" \
vinyl-source-stream@"^1.1.0" \
node-binary-marshal@"^0.4.2" \
term.js@"github:bpowers/term.js"

RUN \
source $NVM_DIR/nvm.sh; \
npm install -g \
tsd@"^0.6.5" \
gulp-tslint@"^6.0.1" \
gulp-imagemin@"^2.4.0" \
tslint@"^3.13.0"

# RUN \
# source $NVM_DIR/nvm.sh; \
# npm install -g \
# node-pipe2@"^0.2.0" \
# node-priority@"^0.1.5"

RUN mkdir -p $HOME/browsix $HOME/browsix-test

COPY . $HOME/browsix
WORKDIR $HOME/browsix
RUN ls

CMD /bin/bash
26 changes: 26 additions & 0 deletions docker/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/sh

# hack to invalidate Docker cache
touch README.md

echo "-------"
echo "tagging: "
REPO_NAME=$(basename `git rev-parse --show-toplevel`)
GIT_REV=$(git rev-parse --short HEAD)

IMAGE_NAME="$REPO_NAME:$GIT_REV"
echo $IMAGE_NAME
echo "-------"

echo "---------"
echo "building: "
docker \
build -t $IMAGE_NAME \
-f ./docker/Dockerfile \
.
echo "---------"

echo "-------"
echo "running: "
docker run -t -i $IMAGE_NAME
echo "-------"