Since Cocos Creator is an electron app, I thought it should be easy to run it on Linux. As a result, successfully launched Cocos Creator app on Ubuntu.
To make it possible,
clone electron tag 1.7.5 which is the version cocos creator uses. Modify atom/common/asar/archive.cc, atom/browser/net/url_request_asar_job.cc and lib/common/asar.js files to decrypt js files and asar header. You can find correct asar.js file from Cocos Creator itself by opening developer tools and find the file ELECTRON_ASAR.js. Finally build the electron by using
Copy Resources folder from Mac version of Cocos Creator to resources folder of the newly built app.
Change node native libraries from mac versions to linux versions. The files are located under
Why I did this because I need a docker image to build the game on CI. You can use
sercand/cocos-creator:1.8.0-web image to build your game for web. An example .gitlab-ci.yml configuration which we use build game on Kubernetes:
- sh /opt/cocos-build.sh --path . --build "platform=web-mobile"
- aws s3 sync ./build/web-mobile s3://$AWS_BUCKET/testing/$CI_COMMIT_SHA
I hope it helps who wants to build their game on ci on each commit. I am currently working on a webpack based library to build cocos-creator projects without using 1.2 GB docker images.