{"action":"created","issue":{"url":"https://api.github.com/repos/slidewiki/slidewiki-platform/issues/585","repository_url":"https://api.github.com/repos/slidewiki/slidewiki-platform","labels_url":"https://api.github.com/repos/slidewiki/slidewiki-platform/issues/585/labels{/name}","comments_url":"https://api.github.com/repos/slidewiki/slidewiki-platform/issues/585/comments","events_url":"https://api.github.com/repos/slidewiki/slidewiki-platform/issues/585/events","html_url":"https://github.com/slidewiki/slidewiki-platform/pull/585","id":261595132,"number":585,"title":"Refactor code to include webpack build phase into docker image build","user":{"login":"kprist","id":2527439,"avatar_url":"https://avatars1.githubusercontent.com/u/2527439?v=4","gravatar_id":"","url":"https://api.github.com/users/kprist","html_url":"https://github.com/kprist","followers_url":"https://api.github.com/users/kprist/followers","following_url":"https://api.github.com/users/kprist/following{/other_user}","gists_url":"https://api.github.com/users/kprist/gists{/gist_id}","starred_url":"https://api.github.com/users/kprist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kprist/subscriptions","organizations_url":"https://api.github.com/users/kprist/orgs","repos_url":"https://api.github.com/users/kprist/repos","events_url":"https://api.github.com/users/kprist/events{/privacy}","received_events_url":"https://api.github.com/users/kprist/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"bwulff","id":191586,"avatar_url":"https://avatars2.githubusercontent.com/u/191586?v=4","gravatar_id":"","url":"https://api.github.com/users/bwulff","html_url":"https://github.com/bwulff","followers_url":"https://api.github.com/users/bwulff/followers","following_url":"https://api.github.com/users/bwulff/following{/other_user}","gists_url":"https://api.github.com/users/bwulff/gists{/gist_id}","starred_url":"https://api.github.com/users/bwulff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bwulff/subscriptions","organizations_url":"https://api.github.com/users/bwulff/orgs","repos_url":"https://api.github.com/users/bwulff/repos","events_url":"https://api.github.com/users/bwulff/events{/privacy}","received_events_url":"https://api.github.com/users/bwulff/received_events","type":"User","site_admin":false},"assignees":[{"login":"bwulff","id":191586,"avatar_url":"https://avatars2.githubusercontent.com/u/191586?v=4","gravatar_id":"","url":"https://api.github.com/users/bwulff","html_url":"https://github.com/bwulff","followers_url":"https://api.github.com/users/bwulff/followers","following_url":"https://api.github.com/users/bwulff/following{/other_user}","gists_url":"https://api.github.com/users/bwulff/gists{/gist_id}","starred_url":"https://api.github.com/users/bwulff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bwulff/subscriptions","organizations_url":"https://api.github.com/users/bwulff/orgs","repos_url":"https://api.github.com/users/bwulff/repos","events_url":"https://api.github.com/users/bwulff/events{/privacy}","received_events_url":"https://api.github.com/users/bwulff/received_events","type":"User","site_admin":false}],"milestone":null,"comments":9,"created_at":"2017-09-29T10:12:26Z","updated_at":"2018-04-18T13:04:57Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/slidewiki/slidewiki-platform/pulls/585","html_url":"https://github.com/slidewiki/slidewiki-platform/pull/585","diff_url":"https://github.com/slidewiki/slidewiki-platform/pull/585.diff","patch_url":"https://github.com/slidewiki/slidewiki-platform/pull/585.patch"},"body":"With this effort the goal is to improve the time it takes for a docker image with the platform to run. Currently, when starting the container, we issue a full webpack build that bundles the webapp assets. The main issues we have with this, is that it takes some time for the container to start (or more importantly, to restart). Also, if there's an error in the webpack build phase, it only shows when starting the container, whereas it should happen sooner, during the build phase.\r\n\r\nThe reason we included the webpack build phase in runtime is because we need to respect environment variables set when starting the container, and those ENV variables changed some files that are part in the webpack bundle.\r\n\r\nThe solution presented here splits the webpack bundle to two phases: one with all the code that does not depend on env variables, and one with those files that need to be modified according to the environment. The latter produces a helper library bundle that the former simply references. The way they are set-up is a bit unorthodox, but the aim was to edit as few files as possible, and also to not interfere in any way with the dev process of the platform, i.e. `npm run dev` is virtually untouched as a process.\r\n\r\nThis has been tested locally and should work for deployments to Docker hub as-is, but needs to be tested. Also, in theory it should work on travis as well, but that should also be verified."},"comment":{"url":"https://api.github.com/repos/slidewiki/slidewiki-platform/issues/comments/382379184","html_url":"https://github.com/slidewiki/slidewiki-platform/pull/585#issuecomment-382379184","issue_url":"https://api.github.com/repos/slidewiki/slidewiki-platform/issues/585","id":382379184,"user":{"login":"ali1k","id":2254157,"avatar_url":"https://avatars1.githubusercontent.com/u/2254157?v=4","gravatar_id":"","url":"https://api.github.com/users/ali1k","html_url":"https://github.com/ali1k","followers_url":"https://api.github.com/users/ali1k/followers","following_url":"https://api.github.com/users/ali1k/following{/other_user}","gists_url":"https://api.github.com/users/ali1k/gists{/gist_id}","starred_url":"https://api.github.com/users/ali1k/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ali1k/subscriptions","organizations_url":"https://api.github.com/users/ali1k/orgs","repos_url":"https://api.github.com/users/ali1k/repos","events_url":"https://api.github.com/users/ali1k/events{/privacy}","received_events_url":"https://api.github.com/users/ali1k/received_events","type":"User","site_admin":false},"created_at":"2018-04-18T13:04:57Z","updated_at":"2018-04-18T13:04:57Z","author_association":"OWNER","body":"I am not much into the docker deployment procedure we have. Nonetheless, from my understanding, we are unnecessarily running the heavy Webpack build process each time the docker container starts, only because of the run-time env variables that we need to apply. If it is the case, it absolutely makes sense to separate those configs from our main bundle and add them at run time. The Webpack config that used externals looks good. I just fixed some template issues for variables and resolved minor lint issues. Also synced it with master.\r\nAfter this change is merged, I am gonna upgrade to Webpack 4 which might also affect the performance for bundling...\r\n\r\n@rmeissn @kprist @bwulff I think this PR is ready to merge. I cannot test the docker build process, if you think it is fine, please go ahead and merge it to master asap as it affects the performance a lot. \r\n"}}
{"actor":{"display_login":"ali1k"}}