diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..b3c5feec --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +* +!src/* +!build/* +!package.json +!package-lock.json +!main.js \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..6c5e5df4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM node:carbon +WORKDIR /srv/www + +# make node_modules cached. +# Src: https://nodesource.com/blog/8-protips-to-start-killing-it-when-dockerizing-node-js/ +# +COPY package.json package-lock.json ./ + +# When running with --production --pure-lockfile, +# There will always be some missing modules. Dunno why... +# +RUN npm install --production + +# Other files, so that other files do not interfere with node_modules cache +# +COPY . . + +EXPOSE 5001 + +ENTRYPOINT NODE_ENV=production node build/index