Running Facebook's Flow in an Alpine Node Container

Create a Dockerfile and an npmrc template

Creating the Dockerfile was more chalanging than expected. To make flow work in Alpine we need glibc. To get glibc from GitHub we need wget with SSL support (and ca-certs).

All in all this Dockerfile works:

FROM node:8-alpine

# Install bash (required by scripts/*) and GNU wget
RUN apk update \
    && apk add \
    bash \
    wget \

# Install glibc comaptibility for alpine (required by flow)
RUN wget \
    --quiet \
    --output-document=/etc/apk/keys/ \ \
    && wget \
    --quiet \ \
    && apk add glibc-2.25-r0.apk

# Slim the image by removing APK cache
RUN rm -rf /var/cache/apk/*

USER node
# This build time argument should be passed by build script.
# See, and .npmrc files
ARG npm_token

WORKDIR                               /home/node
COPY package.json                     ./
COPY package-lock.json                ./
COPY .flowconfig                      ./.flowconfig
COPY npmrc.template                   ./.npmrc
COPY src                              ./src
COPY scripts                          ./scripts

RUN npm install

RUN rm ./.npmrc

CMD npm start