back.Dockerfile 639 B

1234567891011121314151617181920212223
  1. FROM node:11.7.0-alpine
  2. # Back docker image
  3. COPY . /usr/src/app
  4. WORKDIR /usr/src/app
  5. # Server port
  6. EXPOSE 5000
  7. # Install dependencies and generate documentation
  8. RUN yarn install && yarn doc
  9. # Build front if SERVE_CLIENT=true
  10. CMD if [ "$SERVE_CLIENT" == "true" ] ; \
  11. then \
  12. ([ -d ./experimentConfig ] && \
  13. echo "Experiment configuration found" \
  14. || echo "Experiment configuration not found, copying default" && cp -r experimentConfig.default experimentConfig) && \
  15. NODE_ENV=test yarn test && \
  16. yarn run app:build && \
  17. yarn run server:start ; \
  18. else NODE_ENV=test yarn test && yarn run server:start ; fi