{"action":"created","issue":{"url":"https://api.github.com/repos/parse-community/parse-server/issues/4986","repository_url":"https://api.github.com/repos/parse-community/parse-server","labels_url":"https://api.github.com/repos/parse-community/parse-server/issues/4986/labels{/name}","comments_url":"https://api.github.com/repos/parse-community/parse-server/issues/4986/comments","events_url":"https://api.github.com/repos/parse-community/parse-server/issues/4986/events","html_url":"https://github.com/parse-community/parse-server/issues/4986","id":351772353,"node_id":"MDU6SXNzdWUzNTE3NzIzNTM=","number":4986,"title":"Suggestions to improve Dockerfile - reduce image size","user":{"login":"barakbd","id":10120621,"node_id":"MDQ6VXNlcjEwMTIwNjIx","avatar_url":"https://avatars2.githubusercontent.com/u/10120621?v=4","gravatar_id":"","url":"https://api.github.com/users/barakbd","html_url":"https://github.com/barakbd","followers_url":"https://api.github.com/users/barakbd/followers","following_url":"https://api.github.com/users/barakbd/following{/other_user}","gists_url":"https://api.github.com/users/barakbd/gists{/gist_id}","starred_url":"https://api.github.com/users/barakbd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/barakbd/subscriptions","organizations_url":"https://api.github.com/users/barakbd/orgs","repos_url":"https://api.github.com/users/barakbd/repos","events_url":"https://api.github.com/users/barakbd/events{/privacy}","received_events_url":"https://api.github.com/users/barakbd/received_events","type":"User","site_admin":false},"labels":[{"id":318400023,"node_id":"MDU6TGFiZWwzMTg0MDAwMjM=","url":"https://api.github.com/repos/parse-community/parse-server/labels/discussion","name":"discussion","color":"eb6420","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":41,"created_at":"2018-08-18T00:13:55Z","updated_at":"2018-09-06T01:14:34Z","closed_at":null,"author_association":"NONE","body":"**Is your feature request related to a problem? Please describe.**\r\n\r\n1. Use node:carbon-alpine base image to reduce image size (unless you you really need the full size node image)\r\n\r\n3. Volumes:\r\nNo need to mkdir + VOLUME. Also, it is possible to specify multi in one line\r\nhttps://docs.docker.com/engine/reference/builder/#volume\r\n\r\n4. Non-root user:\r\nhttps://github.com/nodejs/docker-node/blob/master/docs/BestPractices.md#non-root-user\r\n\r\n4. Entrypoint - use node and not npm\r\nhttps://github.com/nodejs/docker-node/blob/master/docs/BestPractices.md#docker-run\r\n\r\n3. Multi stage Dockerfile - reduce image size by building final image without devDependencies:\r\nDocker multi stage - [https://docs.docker.com/develop/develop-images/multistage-build/](https://docs.docker.com/develop/develop-images/multistage-build/)\r\nTravisCI supported - [https://github.com/travis-ci/travis-ci/issues/8181](https://github.com/travis-ci/travis-ci/issues/8181)\r\n\r\n**Suggestted Dockerfile**\r\n```Dockerfile\r\nFROM node:carbon-alpine\r\n\r\n#after this you can just use ./ to refer to cwd\r\nWORKDIR /parse-server\r\n\r\n#Specify multiple volumes in one line - reuse layers during build\r\nVOLUME [\"/parse-server/config\", \"/parse-server/cloud\"]\r\n\r\n#Copy into /parse-server which is current working directory\r\nCOPY ./ ./ \r\n\r\nRUN npm install && \\\r\n    npm run build\r\n\r\nENV PORT=1337\r\n\r\nEXPOSE $PORT\r\n\r\n# non-root user\r\nUSER node\r\n\r\n# start with node, not npm\r\nENTRYPOINT [\"node\", \"./bin/parse-server\", \"--\"]\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/parse-community/parse-server/issues/comments/418931374","html_url":"https://github.com/parse-community/parse-server/issues/4986#issuecomment-418931374","issue_url":"https://api.github.com/repos/parse-community/parse-server/issues/4986","id":418931374,"node_id":"MDEyOklzc3VlQ29tbWVudDQxODkzMTM3NA==","user":{"login":"flovilmart","id":364568,"node_id":"MDQ6VXNlcjM2NDU2OA==","avatar_url":"https://avatars3.githubusercontent.com/u/364568?v=4","gravatar_id":"","url":"https://api.github.com/users/flovilmart","html_url":"https://github.com/flovilmart","followers_url":"https://api.github.com/users/flovilmart/followers","following_url":"https://api.github.com/users/flovilmart/following{/other_user}","gists_url":"https://api.github.com/users/flovilmart/gists{/gist_id}","starred_url":"https://api.github.com/users/flovilmart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flovilmart/subscriptions","organizations_url":"https://api.github.com/users/flovilmart/orgs","repos_url":"https://api.github.com/users/flovilmart/repos","events_url":"https://api.github.com/users/flovilmart/events{/privacy}","received_events_url":"https://api.github.com/users/flovilmart/received_events","type":"User","site_admin":false},"created_at":"2018-09-06T01:14:34Z","updated_at":"2018-09-06T01:14:34Z","author_association":"MEMBER","body":"> es, but then you would also have to rm -rf src/ and other items to reduce image size. In any case it is a manual process.\r\n\r\nThe src folder is 1.2Mb... Which is pale in comparison to the node_modules folder..."}}
{"actor":{"display_login":"flovilmart"}}