README
init
init
inspects the specified directory and generates a suggested Dockerile
based on various hueristics used to detect the project type.
mkdir my-awesome-app
cd my-awesome-app
touch server.js
now init
Generates something like:
FROM mhart/alpine-node:8 as base
WORKDIR /usr/src
COPY package.json yarn.lock /usr/src/
RUN yarn --production
COPY . .
FROM alpine:3.8
COPY --from=base /usr/bin/node /usr/bin/
WORKDIR /usr/src
ENV PATH="./node_modules/.bin:$PATH"
ENV NODE_ENV="production"
COPY --from=base /usr/src .
CMD micro server.js
Node.js support features:
- Includes
apk
packages for known native dependencies - Maps
"engines"
field to the proper Alpine base image - Maps the
"scripts.build"
command to run during the build phase - Maps the
"scripts.start"
command to theCMD
of the Dockerfile - Uses
yarn
ornpm
depending on the existence ofyarn.lock
andpackage-lock.json