@zeit/initdeprecated

Inspects the specified directory and generates a suggested `Dockerile`

Usage no npm install needed!

<script type="module">
  import zeitInit from 'https://cdn.skypack.dev/@zeit/init';
</script>

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 the CMD of the Dockerfile
  • Uses yarn or npm depending on the existence of yarn.lock and package-lock.json