back.Dockerfile 983 B

123456789101112131415161718192021222324252627282930
  1. FROM node:12.6.0-alpine
  2. # Back docker image
  3. COPY . /usr/src/app
  4. WORKDIR /usr/src/app
  5. # Server port
  6. EXPOSE 5000
  7. # Install python
  8. RUN apk add --update --no-cache gcc gfortran python python-dev py-pip build-base wget freetype-dev libpng-dev openblas-dev
  9. RUN pip install pymongo
  10. RUN pip install numpy
  11. # Install dependencies and generate documentation
  12. RUN yarn install && yarn doc
  13. # Build front if SERVE_CLIENT=true
  14. CMD if [ "$SERVE_CLIENT" == "true" ] ; \
  15. then \
  16. ([ -f ./experimentConfig.js ] && \
  17. echo "Experiment configuration found" \
  18. || (echo "Experiment configuration not found, copying default" && cp experimentConfig.default.js experimentConfig.js)) && \
  19. ([ -d ./results ] || mkdir results) && \
  20. ([ -f ./results/match_extracts_probs.json ] || echo "[]" >> results/match_extracts_probs.json) && \
  21. NODE_ENV=test yarn test && \
  22. yarn run app:build && \
  23. yarn run server:start ; \
  24. else NODE_ENV=test yarn test && yarn run server:start ; fi