beakerbrowser / beaker

An experimental peer-to-peer Web browser
https://beakerbrowser.com/
MIT License
6.75k stars 546 forks source link

Docker source build #966

Open jcalfee opened 6 years ago

jcalfee commented 6 years ago

Operation System: Docker Beaker version: 0.8.0-prerelease.5

Any interest in a Docker build? I noticed there are a number of extra steps needed to build in beaker in a minimal image. I started the process but I gotinto some npm errors / missing packages that I don't understand. This should be a good start if someone cares to review and complete it.

npm run rebuild was running into missing packages (gulp-less gulp-watch, etc) so I tried adding a npm install (even though that is not in your directions.

FROM debian:sid

RUN apt-get update\
  && apt-get install -y\
    --no-install-recommends\
    libtool m4 make g++\
    ca-certificates git\
    nodejs npm gulp

RUN git clone --branch 0.8.0-prerelease.5 https://github.com/beakerbrowser/beaker.git
RUN cd beaker\
  && npm install\
  && npm run rebuild
#&& npm install q gulp-less gulp-watch\

RUN apt-get remove -y\
  libtool m4 make g++\
  ca-certificates git\
  && rm -rf /var/lib/apt/lists/*\

WORKDIR beaker
ENTRYPOINT [ "npm", "start" ]

Once it all works, the RUN lines can be merged together and more files removed so the final docker image size will be smaller.

pfrazee commented 6 years ago

@jcalfee wouldn't this mean the user has to run Beaker inside docker? What's the downside there?

jcalfee commented 6 years ago

You don't have to run Beaker inside of Docker (although you might want to)..

I'll be happy to help you with Docker goals. Basically if the binary is compatible with the host OS you can just copy any files you want from the docker to the host machine.

To peak our interests (quick rant): I'm moving towards running everything from a Docker file for lots of reasons security (unless there is a better solution). It is still complicated to do but there is a script that is making this practical for an advanced computer user. This could become part of a packing system and available to everyone. The only thing I can think of that makes this unnecessary is to have perfect code built by redundant build machines all attesting that they got a reproducible build hash. The 1st case will never happen. So sand-boxing apps on a PC / Desktop are something I think we are going to need if we want decent security.

pfrazee commented 6 years ago

I've used docker but not extensively. Having Beaker run in docker is definitely out of scope right now. What would the details be of distributing via docker? How would that change things for us doing dev/distribution, and for users downloading it?

jcalfee commented 6 years ago

This week is going to be difficult for me to get questions answered about automated release builds. This is what we have, but I have to ask if they will continue this route: https://github.com/EOSIO/eos/blob/slim/.gitlab-ci.yml

I can find out more about release builds soon though and get a recommendation, probably next week..

If your solution is docker based, once you get your base image and build worked out it is just a matter of configuration and maybe some re-factoring.. You can setup automated builds for github releases for example or automated unit testing on each push (the last commit runs in a docker).

It is a good idea to have a builder image separate from your source code (see multiple FROM entries in eosio/eos' Dockerfile). This way it is more efficient to do frequent source builds (no deps to install) and more developer friendly (they can just use the builder then git clone manually).

Our Dockerfile seems to be pretty stable now: https://github.com/EOSIO/eos/blob/dawn-v3.0.0/Docker/Dockerfile

jcalfee commented 6 years ago

Here are some suggestions:

Automated builds (w/docker plug-in) https://github.com/EOSIO/eos/blob/slim/.buildkite/pipeline.yml Automated docker unit test: https://github.com/EOSIO/eosjs/blob/master/.travis.yml

jcalfee commented 6 years ago

fyi, why eosio is using Buildkite:

Eric Buildkite for both automated builds and unit tests Travis was taking over and hour to complete both, if it completed at all. With buildkite it is right around 20 minutes

paul90 commented 6 years ago

Back to the opening post...

Looking at the logs from npm run rebuild, at least one of the dependencies fails to build due to it containing a npm version requirement in its package.json. The version of npm contained in debian:sid being very old 1.4.21.

You might get better results using node:carbon, or one of its variants, rather than debian:sid.

To run beaker from within docker you will need to add windowing support.

jcalfee commented 6 years ago

Thanks, looks like FROM ubuntu:bionic is a better choice. That gets me to this point:

...
> beakerbrowser@ build /beaker
> gulp build

[13:46:00] Using gulpfile /beaker/gulpfile.js
[13:46:00] Starting 'burnthemall-maybe'...
[13:46:00] Finished 'burnthemall-maybe' after 977 μs
[13:46:00] Starting 'bundle'...
[13:46:00] Starting 'less'...
[13:46:00] Finished 'less' after 19 ms
'TimeoutError' is imported from external module 'beaker-error-constants' but never used
'default' is imported from external module 'bytes' but never used
'TimeoutError' is imported from external module 'beaker-error-constants' but never used
'default' is imported from external module 'parse-dat-url' but never used
'TimeoutError' is imported from external module 'beaker-error-constants' but never used
'FSArchiveFolder' and 'FSArchiveFile' are imported from external module 'beaker-virtual-fs' but never used
'join' is imported from external module 'path' but never used
'TimeoutError' is imported from external module 'beaker-error-constants' but never used
'default' is imported from external module 'function-queue' but never used
'DestDirectoryNotEmpty' is imported from external module 'beaker-error-constants' but never used
[13:46:03] 'bundle' errored after 3.2 s
[13:46:03] Error: Cannot find module 'remarkable' from '/beaker/app'
    at /beaker/node_modules/browser-resolve/node_modules/resolve/lib/async.js:46:17
    at process (/beaker/node_modules/browser-resolve/node_modules/resolve/lib/async.js:173:43)
    at ondir (/beaker/node_modules/browser-resolve/node_modules/resolve/lib/async.js:188:17)
    at load (/beaker/node_modules/browser-resolve/node_modules/resolve/lib/async.js:69:43)
    at onex (/beaker/node_modules/browser-resolve/node_modules/resolve/lib/async.js:92:31)
    at /beaker/node_modules/browser-resolve/node_modules/resolve/lib/async.js:22:47
    at FSReqWrap.oncomplete (fs.js:152:21)

NPM versoin 3.5.2 Nodejs 8.10.0