back.Dockerfile 895 B

1234567891011121314151617181920212223242526272829
  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 python python-dev py-pip
  9. RUN pip install pymongo
  10. # Install dependencies and generate documentation
  11. RUN yarn install && yarn doc
  12. # Build front if SERVE_CLIENT=true
  13. CMD if [ "$SERVE_CLIENT" == "true" ] ; \
  14. then \
  15. ([ -f ./experimentConfig.js ] && \
  16. echo "Experiment configuration found" \
  17. || (echo "Experiment configuration not found, copying default" && cp experimentConfig.default.js experimentConfig.js)) && \
  18. ([ -d ./results ] || mkdir results) && \
  19. ([ -f ./results/match_extracts_probs.json ] || echo "[]" >> results/match_extracts_probs.json) && \
  20. NODE_ENV=test yarn test && \
  21. yarn run app:build && \
  22. yarn run server:start ; \
  23. else NODE_ENV=test yarn test && yarn run server:start ; fi