back.Dockerfile 829 B

123456789101112131415161718192021222324252627
  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 apt install -y python3-pip
  9. RUN apt install build-essential libssl-dev libffi-dev python3-dev
  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 && mkdir results && echo "[]" >> results/match_extracts_probs.json)) && \
  18. NODE_ENV=test yarn test && \
  19. yarn run app:build && \
  20. yarn run server:start ; \
  21. else NODE_ENV=test yarn test && yarn run server:start ; fi