Guest User

Untitled

a guest
Dec 16th, 2018
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.02 KB | None | 0 0
  1. FROM python:3.6
  2.  
  3. RUN mkdir /web WORKDIR /web ADD . /web/ RUN pip install -r requirements.txt
  4.  
  5.  
  6. ENV FLASK_ENV="docker" EXPOSE 5000 CMD ["python", "mongo.py"]
  7.  
  8. version: '3'
  9. services:
  10. # Define the Flask web application
  11. flaskapp:
  12.  
  13. # Build the Dockerfile that is in the web directory
  14. build: ./web
  15.  
  16. # Always restart the container regardless of the exit status; try and restart the container indefinitely
  17. restart: always
  18.  
  19. # Expose port 8000 to other containers (not to the host of the machine)
  20. expose:
  21. - "8000"
  22.  
  23. # Mount the web directory within the container at /home/flask/app/web
  24. # volumes:
  25. # - ./web:/homvole/flask/app/web
  26.  
  27. # Don't create this container until the redis and mongo containers (below) have been created
  28. depends_on:
  29. - redis
  30. - mongo
  31.  
  32. # Link the redis and mongo containers together so that they can talk to one another
  33. links:
  34. - redis
  35. - mongo
  36.  
  37. # Pass environment variables to the flask container (this debug level lets you see more useful information)
  38. environment:
  39. FLASK_DEBUG: 1
  40.  
  41. # Deploy with 3 replicas in the case of failure of one of the containers (only in Docker Swarm)
  42. deploy:
  43. mode: replicated
  44. replicas: 3
  45.  
  46. # Define the redis Docker container
  47. redis:
  48.  
  49. # use the redis:alpine image: https://hub.docker.com/_/redis/
  50. image: redis:alpine
  51. restart: always
  52. deploy:
  53. mode: replicated
  54. replicas: 3
  55.  
  56. # Define the redis NGINX forward proxy container
  57.  
  58.  
  59. # Define the mongo database
  60. mongo:
  61. image: mongo
  62. restart: always
  63. environment:
  64. MONGO_INITDB_ROOT_USERNAME: root
  65. MONGO_INITDB_ROOT_PASSWORD: root
  66.  
  67. mongo-express:
  68. image: mongo-express
  69. restart: always
  70. ports:
  71. - 8081:8081
  72. environment:
  73. ME_CONFIG_MONGODB_ADMINUSERNAME: root
  74. ME_CONFIG_MONGODB_ADMINPASSWORD: root
  75.  
  76. # Expose port 5432 to other Docker containers
  77. expose:
  78. - "8081"
  79.  
  80. Serving Flask app "mongo" (lazy loading)
  81. Environment: docker
  82. Debug mode: off
  83. Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
Add Comment
Please, Sign In to add comment