--- title: How to run a HackMD with docker - slide disqus: hackmd --- <style> .reveal { font-size: 36px !important; } </style> <i class="fa fa-file-text"></i> HackMD === Best way to write and share your knowledge in markdown. ---- <img src="https://i.imgur.com/PTbB46S.jpg" style="width:200px;height:200px;border-radius:50%"/> #### Max Wu NTUT CSIE graduate student Current Team Lead of <i class="fa fa-file-text"></i> HackMD > Trying to build a new world with keyboard; > I'm dreaming instead of coding. --- <i class="fa fa-file-text"></i> HackMD === Realtime collaborative markdown notes on all platforms. ---- Methology --- - realtime (real-time) - around 10~20ms - collaborative - work together - markdown - let's talk about this later - all platforms - across desktop, mobile, tablet ---- Statistics --- - More than 120,000 notes have been taken on us - More than 72,000 users actively using us every month - More than 4,500 people writing on us every day - Our repo have been starred more than 1,900 times :star2: - Thank you :+1: --- Markdown --- - Lightweight - Visual friendly - Markup language - CommonMark is hot :fire: - Parse as you wish! ---- Who use it? --- - GitHub <i class="fa fa-github"></i> / Bitbucket / GitLab <i class="fa fa-gitlab"></i> - Stack Overflow <i class="fa fa-stack-overflow"></i> - Reddit <i class="fa fa-reddit"></i> - You :tada: ---- What HackMD do? --- - Make markdown collaborative! - Fulfill more engineers writing needs - Integrate docs to workflow deeper - Standandrize publishing via format and meta - We would love hear you voice :heart: ---- What you can do with HackMD? --- - Notes :notebook: - Docs :book: - Slides :tv: - Blogs :b: --- Why not own one? === ![](https://www.docker.com/sites/default/files/legal/small_v-dark.png) :100: WITH THE DOCKER POWER :100: --- docker-hackmd === - https://github.com/hackmdio/docker-hackmd - First from Japanese developer - Auto build with Docker Hub ---- Get started === 1. You need - `docker` - `docker-machine` - `docker-compose` You can get them from: - Docker Toolbox - Docker Community Edition ---- 2. Start docker with terminal 3. Get our repo via git ``` git clone https://github.com/hackmdio/docker-hackmd.git ``` ---- 4. Change directory to it ![](https://i.imgur.com/iFegfTi.png) 5. `docker-compose up` in your terminal ![](https://i.imgur.com/wf2DN4J.png) ---- 6. It will auto fetch postgresql and hackmd images 7. WAIT FRO FEW MINUTES :coffee: ---- 8. Open any browser and surf <machine IP>:3000 ![](https://i.imgur.com/i4T2VsS.png) 9. Now you can have it :raised_hands: --- HackMD Desktop === - The fabulous desktop app of HackMD :tada: - https://github.com/hackmdio/hackmd-desktop/releases ---- Connect it to your container! --- 1. Menu -> Edit -> Customize HackMD server ![](https://i.imgur.com/KJtEtaR.png) ---- 2. Type `localhost:3000` and Save 3. Feel the epic :sparkling_heart: ![](https://i.imgur.com/W2xN1bF.png) --- How To: Minimize docker image for Node.js --- - Most size are from the base image - Node.js official image are built with Debain and Alpine - Alpine is smaller but lacking support of some package (phantom.js) - Current LTS is boron (6.10) - https://github.com/nodejs/docker-node ---- How To: Minimize docker image for Node.js (cont.) --- - Every `RUN` will cause a new layer - Concat all related commands to reduce layers - Layers can be cached so don't make them all to one ---- How To: Minimize docker image for Node.js (cont.) --- - <i class="fa fa-git"></i> can be fat - Only clone the branch that you need - Clone in `--depth 1` to use a shallow copy - Remove `.git` directory after clone ---- How To: Minimize docker image for Node.js (cont.) --- - The npm modules :anger: - Please specify dev dependencies - Clean with `npm prune --production` ---- How To: Minimize docker image for Node.js (cont.) --- - Use https://microbadger.com to check your docker image size and layers number ![](https://i.imgur.com/ffctns9.png) --- # Thanks for listening :smile: https://hackmd.io/s/Hk39SWD0x **Max Wu @ DigitalOcean Hsinchu meetup**