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 Dockerfile for Windows and Linux builds #1765

Merged
merged 2 commits into from
Jul 18, 2020
Merged

Conversation

Volatus
Copy link
Contributor

@Volatus Volatus commented Jul 18, 2020

Please note: we will close your PR without comment if you do not check the boxes above and provide ALL requested information.


@Volatus Volatus requested a review from evereq July 18, 2020 16:36
@Volatus Volatus added the type: devops DevOps related request label Jul 18, 2020
@evereq
Copy link
Member

evereq commented Jul 18, 2020

@IsmayilMirzali hm, I am thinking maybe it's better to just split it to 2 dockerfiles, one for each OS? Because we anyway will need third one for Mac OS and we can't keep it in the same file you have now ;) What you think?

@Volatus
Copy link
Contributor Author

Volatus commented Jul 18, 2020

@evereq Can definitely do that. Do we want seperate directories for each? (Maybe desktop-linux and desktop-windows for now) Or should I have all of them but named differently in 1 directory?

@evereq
Copy link
Member

evereq commented Jul 18, 2020

@IsmayilMirzali maybe like Dockerfile.win and Dockerfile.mac and Dockerfile.linux, all in one folder?

@Volatus
Copy link
Contributor Author

Volatus commented Jul 18, 2020

@evereq Done. Just side note, we wouldn't be able to use a Docker image for MacOS, since such an image doesn't really exist without some tricks with QEMU or KVM.

@evereq
Copy link
Member

evereq commented Jul 18, 2020

@IsmayilMirzali hm, I am not sure understand it... I.e. why can't we have a similar Dockerfile like Linux one you did already, which will be just running in Docker on Mac and it will be able to build Electron app which targets Mac Os? Using for example yarn run build:desktop:mac, see https://github.com/ever-co/gauzy/blob/develop/package.json#L75? What is the difference with the same Dockerfile for Linux???

@evereq
Copy link
Member

evereq commented Jul 18, 2020

Also please see https://www.electron.build/multi-platform-build, it includes sample travis.yml which actually use osx image to build for Mac Os, seems they do it without docker at all, so maybe we don't even need it... But still, I would like to have Dockerfile.mac if it's possible and if it's not possible, then understand better why :)

@evereq evereq merged commit d1649b6 into develop Jul 18, 2020
@evereq evereq deleted the feat/desktop-dockerfile branch July 18, 2020 19:25
@Volatus
Copy link
Contributor Author

Volatus commented Jul 18, 2020

@evereq Travis builds on a mac machine, image in that context is different than a docker image. (My plan was to just have TravisCI build the Mac app on a mac machine)The reason you cant have a Dockerfile on Mac that would build for Mac is because Docker on Mac is essentially a virtual machine to host a linux kernel so you can use Docker. (Docker heavily relies on cgroups and Pid namespacing of the Linux kernel) Basically, docker on Mac is really just running a Linux environment through virtualization and a linux environment is not capable of being a build system for Mac tools. To be able to build for Mac, you'd need their build system/tools, their specific system calls for memory allocation, whatever dynamically or statically linked dependency and what not. Docker was built for Linux and never meant to be a cross-platform way to use any software from Windows, Linux, Mac etc. (They can't because of licensing restrictions)
Tl;Dr Docker is meant for running Linux containers so it can build for Linux, but can't build for Mac because it's missing a lot of things and would need their Darwin kernel. You can't really run MacOS on a linux kernel, you'd need some form of hardware virtualization. (Hence, QEMU or KVM) There exists essentially no Docker image for MacOS.

@evereq
Copy link
Member

evereq commented Jul 18, 2020

Hm, of course, I know most of that, but I don't think you understand me.
I don't want to run Mac OS inside Docker on Linux or on Windows, that will never work !!!!
I want to run Docker on Mac with Mac OS on a host of course (i.e. CircleCI provide host Mac Servers with Mac OS on them and use that for docker builds, same as Travis, etc).
Imagine this: a user of Macbook want to run Gauzy Desktop app. One way for him will be to setup everything directly on his Mac. Another way will be just to use Dockerfile we create specifically for Mac which builds the Electron app for Mac! So I don't really understand where is the difference here compared to how it works already for Windows or Linux... We are not talking about mixing of things (Mac -> Linux etc). We are talking about running Mac with Mac Os with Docker which builds Electron app which target Mac Os. That's MUST work!

I.e. can person run Docker on Mac? Of course! Can we create Dockerfile which will be used by that person to build Electron app for Mac Os? I think YES. And it's exactly what we need. We are NOT going to run such Dockerfile on Jenkins for example because we don't have Mac Servers where we can run agent so it builds on Mac OS. But we don't need to do that. All we want is to provide to some customers of Gauzy who happen to use Macbook to be able to easy build our Gauzy Desktop app....

@Volatus
Copy link
Contributor Author

Volatus commented Jul 18, 2020

Obviously they can run our Dockerfiles on Mac and build them, for windows and linux but not Mac. Because once the build happens inside Docker, they're essentially out of scope of the Mac host. (because they're inside a VM, on Mac docker runs on a VM) The reason you can build for windows is because the build happens in a Linux container that has Wine, there is no such compatibility layer between Win-Mac or Linux-Mac, but there is no compatibility layer to simulate a Mac. You can obviously simulate Linux (with a VM) or Windows (VM or Wine). Hope this makes sense. The easiest way for them to build on Mac would be to just clone the source and run the commands as normal. Hope this makes sense.

@evereq
Copy link
Member

evereq commented Jul 18, 2020

Well, can you check https://medium.com/@calbertts/developing-electron-apps-in-macos-afd21b4a59e3?

It said (it's in 2017):

now we have ‘Docker for Mac’ and thanks to XQuartz we can run desktop apps in MacOS by using a Docker container.

So I thought maybe to be able to just build (and run if needed) Electron Desktop app in the docker you can install some "tools" and it will work? The reason I thought it should be possible is that because Electron apps are essentially a Chromium / Node etc and it might not really need full Mac hardware to build such apps (and even to run them). Could be however for signing we will still need Mac haha, but in this case, we will have Travis / Circle, etc. If some developer wants to build/run Gauzy for testing, he may not need to sign it on Mac. Hope you understand what I mean...

So just to summarize: yes, we will not be able to build "Native" Mac OS apps in Docker probably, but Electron apps, maybe it's much more simple because of "limited" access to Mac-specific hardware features, etc?

I don't have time to research all that and it's not my focus :)
Anyway, if you think it's too hard or impossible, let's skip that haha

@Volatus
Copy link
Contributor Author

Volatus commented Jul 18, 2020

That article is very similar to X11 forwarding, essentially, they still have a Linux Docker container, but they can run the electron app inside the container but interact with it on the host using XQuartz. So we can't write a Dockerfile for it, but people can get XQuartz for personal use. We'll just use Travis for our macOS release, it should be pretty straightforward. But no, it doesn't solve our Dockerfile issue, we can't make the package for macOS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: devops DevOps related request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants