Dockerfile 924 B

1234567891011121314151617181920212223242526272829303132333435
  1. FROM node:16.13.0-alpine as build
  2. COPY package.json /app/package.json
  3. WORKDIR /app
  4. # Install node_modules
  5. # * to optionally copy lock files that _might_ _not_ exist
  6. ADD package.json package-*.json yarn.* /tmp/
  7. RUN cd /tmp && apk --update add --virtual native-dep \
  8. make gcc g++ python3 libgcc libstdc++ git && \
  9. corepack yarn install && \
  10. apk del native-dep
  11. RUN mkdir -p /app && cd /app && ln -nfs /tmp/node_modules
  12. RUN apk add bash
  13. COPY . /app
  14. ENV PATH "${PATH}:/app/node_modules/.bin"
  15. RUN corepack yarn run build
  16. FROM node:16.13.0-alpine
  17. RUN mkdir -p /app
  18. WORKDIR /app
  19. # copy required files from build stage.
  20. COPY --from=build /app/bin /app/bin
  21. COPY --from=build /app/lib /app/lib
  22. COPY --from=build /app/package.json /app/package.json
  23. COPY --from=build /tmp/node_modules /app/node_modules
  24. ENV PATH "${PATH}:/app/node_modules/.bin"
  25. CMD ["node","/app/bin/companion"]
  26. # This can be overruled later
  27. EXPOSE 3020