Skip to content

Instantly share code, notes, and snippets.

@ifiok
ifiok / docker node dockerfile
Created December 30, 2019 15:03 — forked from victory1908/docker node dockerfile
docker node #docker
I took one of my current projects and basically ran your Dockerfile...and got a 1.1 GB docker save tar file. It compresses well, but a 345 MB gzipped tar file still isn't what you're after. "Use an Alpine base image" is somewhat helpful, but not a silver bullet; switching it to be FROM node:8-alpine reduces it to a 514 MB uncompressed tar file.
If you don't already have a .dockerignore file, then your entire existing node_modules directory will get copied into the image. (In particular, the COPY . . step will copy your entire working tree in, overwriting the installed modules from the previous step.) It can just contain the single line
node_modules
The Alpine base image, plus not emitting a duplicate node_modules tree, gets me down to 382 MB uncompressed.
Notice in your example that your npm install step includes all of the development dependencies as well as the runtime dependencies. That can be a significant cost. If your application doesn't need any precompilation (it is plain JavaScript that Node can r
@ifiok
ifiok / Jenkinsfile
Created April 6, 2019 22:49 — forked from robertstettner/Jenkinsfile
Example Jenkinsfile
pipeline {
stages {
stage("install") {
agent {
docker {
reuseNode true
image 'node:6.10'
}
}
steps {
@ifiok
ifiok / gotham.md
Created August 21, 2018 08:32 — forked from mfd/ gotham.md
Gotham font
https://cdn.rawgit.com/mfd/f3d96ec7f0e8f034cc22ea73b3797b59/raw/856f1dbb8d807aabceb80b6d4f94b464df461b3e/gotham.css

<link rel="https://cdn.rawgit.com/mfd/f3d96ec7f0e8f034cc22ea73b3797b59/raw/856f1dbb8d807aabceb80b6d4f94b464df461b3e/gotham.css">