Guest User

Untitled

a guest
Mar 22nd, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.30 KB | None | 0 0
  1. version: '3.1'
  2.  
  3. services:
  4. db:
  5. image: mysql
  6. restart: always
  7. environment:
  8. - MYSQL_DATABASE=mgsv
  9. - MYSQL_USER=mgsv_user
  10. - MYSQL_PASSWORD=mgsvpass
  11. - MYSQL_ROOT_PASSWORD=mysql123
  12. volumes:
  13. - ./mysql:/docker-entrypoint-initdb.d
  14.  
  15. www:
  16. build: ./mGSV
  17. restart: always
  18. ports:
  19. - 8080:80
  20.  
  21. <?php
  22. echo "Hello World!";
  23. //mysqli_connect("localhost","my_user","my_password","my_db");
  24. $con = mysqli_connect("localhost","mgsv_user","mgsvpass","mgsv");
  25.  
  26. // Check connection
  27. if (mysqli_connect_errno())
  28. {
  29. echo "Failed to connect to MySQL: " . mysqli_connect_error();
  30. }
  31. else {
  32. echo "done";
  33. }
  34. ?>
  35.  
  36. FROM php:5-apache
  37.  
  38. RUN apt-get update && apt-get install -y --no-install-recommends
  39. openjdk-7-jdk
  40. maven
  41. git
  42. && rm -rf /var/lib/apt/lists/*
  43.  
  44. RUN docker-php-source extract
  45. && docker-php-ext-install mysql mysqli pdo pdo_mysql
  46. && docker-php-source delete
  47.  
  48. RUN cd /var/www/html/ && git clone https://github.com/qunfengdong/mGSV.git
  49.  
  50. # Move the folder 'mgsv' to DocumentRoot of Apache web server. By default, the DocumentRoot of Apache is /var/www/ (speak to the system administrator to know the exact DocumentRoot).
  51. RUN cd /var/www/html/mGSV
  52. && mkdir tmp
  53. && chmod -R 777 tmp
  54.  
  55. RUN cd /var/www/html/mGSV && sed -i.bak "s|'gsv'|'mgsv_user'|" lib/settings.php
  56. && sed -i.bak "s|$database_pass = ''|$database_pass = 'mgsvpass'|" lib/settings.php
  57. && sed -i.bak "s|cas-qshare.cas.unt.edu|localhost|" lib/settings.php
  58.  
  59. RUN cp /var/www/html/mGSV/Arial.ttf /usr/share/fonts/truetype/
  60.  
  61. RUN cd /var/www/html/mGSV/ws
  62. && tar -xzf mgsv-ws-server.tar.gz
  63.  
  64. RUN cd /var/www/html/mGSV/ws/mgsv-ws-server
  65. && mvn package
  66.  
  67. RUN cp -f /var/www/html/mGSV/ws/mgsv-ws-server/target/ws-server-1.0RC1-jar-with-dependencies.jar /var/www/html/mGSV/ws/
  68.  
  69. RUN cd /var/www/html/mGSV/ws
  70. && echo "mgsv_upload_url=http://localhost/mgsv" > config.properties
  71. && echo "ws_publish_url=http://localhost:8081/MGSVService" >> config.properties
  72. && java -jar ws-server-1.0RC1-jar-with-dependencies.jar &
  73.  
  74. COPY ./index.php /var/www/html/
  75. RUN a2enmod rewrite
  76.  
  77. Hello World!
  78. Warning: mysqli_connect(): (HY000/2002): No such file or directory in /var/www/html/index.php on line 4
  79. Failed to connect to MySQL: No such file or directory
Add Comment
Please, Sign In to add comment