FROM openfaas/classic-watchdog:0.18.0 as watchdog
FROM alpine:3.9
# 多阶段构建。存在多个 FROM 指令,每个 FROM 指令代表一个 stage 的开始部分。
RUN mkdir -p /home/app
# --from=watchdog,拷贝来自将第一阶段的fwatchdog
COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog
RUN chmod +x /usr/bin/fwatchdog
# Add non root user
RUN addgroup -S app && adduser app -S -G app
RUN chown app /home/app
WORKDIR /home/app
USER app
# Populate example here - i.e. "cat", "sha512sum" or "node index.js"
ENV fprocess="sort"
# Set to true to see request in function logs
ENV write_debug="false"
EXPOSE 8080
HEALTHCHECK --interval=3s CMD [ -e /tmp/.lock ] || exit 1
# 最后是通过fwatchdog启动的
CMD ["fwatchdog"]