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

Add a Dockerfile for easy builds #615

Conversation

rjcorwin
Copy link

My Mac doesn't meet the dependencies for building this. I'm getting some complaint about my version of Python. I don't really want to mod my Mac for every project's own unique needs these days so I use Dockerfiles as build machines so the build can happen in a container. This is is nice for documenting the requirements for building, documenting the the process for building, and lastly for consistency of builds not to mention avoiding the "Oh shit we lost Bob's laptop, now we can't compile, we have to shut the project down" problem.

Now the only dependency is Docker so we can do a build like...

$ git clone https://github.com/zeit/hyperterm.git
$ cd hyperterm
$ docker build -t hyperterm .
$ docker run -v $(pwd)/dist:/hyperterm/dist hyperterm

The result is the same. You'll find a dist folder in your hyperterm directory on your host machine with the builds that happened inside the container.

... of course, the result of this still complains about missing Python so the build fails. Can someone solve this? I don't know what version of Python this project requires. Bob does.

@TooTallNate
Copy link
Member

I have Python 2.7.10 on my OS X machine, FYI

@crunchtime-ali
Copy link

Why would you want to build it as a OS X user using Docker?
All you get is the Unix-binary you can only use in a VM or in a container using xhyve (Docker for Mac)

@rauchg
Copy link
Member

rauchg commented Aug 13, 2016

I don't understand the python problem. Where are we using python? Is it one of our deps?

@rjcorwin
Copy link
Author

rjcorwin commented Aug 13, 2016

@dj-hedgehog I think I see what you are saying. Is it "If you build hyperterm in a Linux environment, it will only result in a build of hyperterm that works only for Linux ". Is that right? That's not the case when creating executables for platforms using tools like Cordova. Is it always the case that with Electron you can only build apps for the platform you are building from?

@rauchg
Copy link
Member

rauchg commented Aug 13, 2016

Our build process works on Linux, Windows and OSX.

@rjcorwin
Copy link
Author

@TooTallNate Looks like I'm on Python 3.5.1.

 ⚡ python --version
Python 3.5.1 :: Anaconda 2.4.1 (x86_64)

@rauchg Here's a log containing a bunch of errors around python when I try npm install.

log.txt

Our build process works on Linux, Windows and OSX.

The question is not "Can we perform a build on X platform?" but more like "Can we do a build on X platform that produces an executable on Y platform?" In this case it's "Can we do a build in Ubuntu that produces and executable for Mac?" If so, then we can reliably build Hyperterm for Mac from a Mac that has Docker for Mac installed.

@ppot
Copy link
Contributor

ppot commented Aug 14, 2016

@rjsteinert Seem pretty much an issue with support of node-gyp.
Coming from node-gyp:
On Mac OS X: python (v2.7 recommended, v3.x.x is not supported)
What is your node version and npm version ?
Take a look at nodejs/node-gyp#746

@@ -0,0 +1,10 @@
FROM ubuntu:14.04
Copy link
Contributor

Choose a reason for hiding this comment

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

I would recommend (alpine-node](https://hub.docker.com/r/mhart/alpine-node/). Images are way smaller.

Choose a reason for hiding this comment

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

FYI, Node.js compiled against glibc isn't officially (upstream) supported on a musl-based system.

Copy link
Contributor

Choose a reason for hiding this comment

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

Understood.

Copy link
Author

Choose a reason for hiding this comment

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

@fearphage I think the last time I tried to base an image on alpine I gave up because of a lack of package manager. Also, cool tip on the using ADD instead of curl! Unfortunately I rebase my last commit to this in and it looks like it blew away your comment on what you suggested. I'm surprised Github even removed it from the flow of this comments on this PR :(.

@jbergstroem
Copy link

@rjsteinert Python 3 isn't supported by Node.js (through gyp). I wouldn't necessarily call this a hyperterm-related issue seeing how you will run into the same problem on any system using Python 3 and Node.js. There's "somewhat" progress here but I don't think one should expect py3 support in gyp anytime soon.

@rjcorwin rjcorwin force-pushed the feature--add-a-dockerfile-for-easy-builds branch from ed3b4db to a7d8edc Compare August 24, 2016 12:46
@rjcorwin
Copy link
Author

Woohoo! This works now as described in my change to the README. Only problem is, as @dj-hedgehog alluded to, all I have generated is an executable for Linux when I'm ultimately trying to generate an executable for Mac. So this is a reliable way for generating the Linux version of Hyperterm on either Mac or Linux without having to modify your python version but not yet a way to reliably generate the Mac version.

As I mentioned before, tools like Cordova allow you to compile for more than one "platform" as they call it. I wonder if we can do the same so that your Linux container can produce the Mac.app.

@flybayer
Copy link
Contributor

@rjsteinert, does this provide any insight for you?

https://github.com/electron-userland/electron-builder/wiki/Multi-Platform-Build

@gurinderhans
Copy link

Possible to try this? https://github.com/electron-userland/electron-packager . I am not fully successfull with it however, the build works perfectly (I can build from linux docker container for macOS) however when I try to run it, I get this.
screen shot 2016-09-18 at 2 21 54 pm

I'm guessing this has to do with hyperterm being dependent on the system npm instead of using its own internal npm.

If someone else gets this to work, however it may be, using Docker, please comment here :)

@rauchg
Copy link
Member

rauchg commented Sep 19, 2016

I think this is a lot of work for limited effect. Like it was mentioned, this only gets you a Linux build. The only way to get all the builds right is to rely on the travis matrix. I appreciate the work, but ultimately I'd like one less thing to maintain.

@rauchg rauchg closed this Sep 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants