Skip to content

Instantly share code, notes, and snippets.

@hemaprasad05
Forked from jcavat/Dockerfile
Created July 6, 2023 06:17
Show Gist options
  • Save hemaprasad05/f3576de1d443750bf35edd0cf3b3a0d5 to your computer and use it in GitHub Desktop.
Save hemaprasad05/f3576de1d443750bf35edd0cf3b3a0d5 to your computer and use it in GitHub Desktop.

Revisions

  1. @jcavat jcavat revised this gist Mar 14, 2017. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -21,6 +21,7 @@ services:
    MYSQL_ROOT_PASSWORD: test
    volumes:
    - ./dump:/docker-entrypoint-initdb.d
    - persistent:/var/lib/mysql
    networks:
    - default
    phpmyadmin:
    @@ -33,5 +34,5 @@ services:
    MYSQL_USER: user
    MYSQL_PASSWORD: test
    MYSQL_ROOT_PASSWORD: test
    volumes:
    - /sessions
    volumes:
    persistent:
  2. @jcavat jcavat revised this gist Mar 13, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion index.php
    Original file line number Diff line number Diff line change
    @@ -17,7 +17,7 @@

    <?php

    $conn = mysqli_connect('db', 'user', 'merde', "myDb");
    $conn = mysqli_connect('db', 'user', 'test', "myDb");


    $query = 'SELECT * From Person';
  3. @jcavat jcavat revised this gist Mar 13, 2017. 1 changed file with 0 additions and 3 deletions.
    3 changes: 0 additions & 3 deletions index.php
    Original file line number Diff line number Diff line change
    @@ -17,8 +17,6 @@

    <?php

    // Connexion et sélection de la base
    //$conn = mysqli_connect('172.19.0.2', 'user', 'merde', "myDb");
    $conn = mysqli_connect('db', 'user', 'merde', "myDb");


    @@ -38,7 +36,6 @@
    }
    echo '</table>';

    /* Libération du jeu de résultats */
    $result->close();

    mysqli_close($conn);
  4. @jcavat jcavat revised this gist Mar 13, 2017. 2 changed files with 11 additions and 10 deletions.
    10 changes: 0 additions & 10 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -1,10 +0,0 @@
    Create this directories structure:
    .
    - docker-compose.yml
    - Dockerfile
    - dump
    - myDb.sql
    - sessions
    - www
    - index.php

    11 changes: 11 additions & 0 deletions README.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    Create this directories structure:
    .
    ├── docker-compose.yml
    ├── Dockerfile
    ├── dump
    │   └── myDb.sql
    ├── sessions
    └── www
    └── index.php


  5. @jcavat jcavat revised this gist Mar 13, 2017. 1 changed file with 7 additions and 7 deletions.
    14 changes: 7 additions & 7 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,10 @@
    Create this directories structure:
    .
    ├── docker-compose.yml
    ├── Dockerfile
    ├── dump
    │   └── myDb.sql
    ├── sessions
    └── www
    └── index.php
    - docker-compose.yml
    - Dockerfile
    - dump
    - myDb.sql
    - sessions
    - www
    - index.php

  6. @jcavat jcavat revised this gist Mar 13, 2017. No changes.
  7. @jcavat jcavat revised this gist Mar 13, 2017. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -7,3 +7,4 @@ Create this directories structure:
    ├── sessions
    └── www
    └── index.php

  8. @jcavat jcavat revised this gist Mar 13, 2017. 2 changed files with 58 additions and 0 deletions.
    9 changes: 9 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    Create this directories structure:
    .
    ├── docker-compose.yml
    ├── Dockerfile
    ├── dump
    │   └── myDb.sql
    ├── sessions
    └── www
    └── index.php
    49 changes: 49 additions & 0 deletions index.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,49 @@
    <!-- put in ./www directory -->

    <html>
    <head>
    <title>Hello...</title>

    <meta charset="utf-8">

    <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
    <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>

    </head>
    <body>
    <div class="container">
    <?php echo "<h1>Hi! I'm happy</h1>"; ?>

    <?php

    // Connexion et sélection de la base
    //$conn = mysqli_connect('172.19.0.2', 'user', 'merde', "myDb");
    $conn = mysqli_connect('db', 'user', 'merde', "myDb");


    $query = 'SELECT * From Person';
    $result = mysqli_query($conn, $query);

    echo '<table class="table table-striped">';
    echo '<thead><tr><th></th><th>id</th><th>name</th></tr></thead>';
    while($value = $result->fetch_array(MYSQLI_ASSOC)){
    echo '<tr>';
    echo '<td><a href="#"><span class="glyphicon glyphicon-search"></span></a></td>';
    foreach($value as $element){
    echo '<td>' . $element . '</td>';
    }

    echo '</tr>';
    }
    echo '</table>';

    /* Libération du jeu de résultats */
    $result->close();

    mysqli_close($conn);

    ?>
    </div>
    </body>
    </html>
  9. @jcavat jcavat revised this gist Mar 13, 2017. 2 changed files with 28 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions Dockerfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,2 @@
    FROM php:7.1.2-apache
    RUN docker-php-ext-install mysqli
    26 changes: 26 additions & 0 deletions myDb.sql
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    -- put in ./dump directory

    SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
    SET time_zone = "+00:00";


    /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
    /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
    /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
    /*!40101 SET NAMES utf8mb4 */;


    CREATE TABLE `Person` (
    `id` int(11) NOT NULL,
    `name` varchar(20) NOT NULL
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1;


    INSERT INTO `Person` (`id`, `name`) VALUES
    (1, 'William'),
    (2, 'Marc'),
    (3, 'John');

    /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
    /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
    /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
  10. @jcavat jcavat created this gist Mar 13, 2017.
    37 changes: 37 additions & 0 deletions docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,37 @@
    version: "2"
    services:
    www:
    build: .
    ports:
    - "8001:80"
    volumes:
    - ./www:/var/www/html/
    links:
    - db
    networks:
    - default
    db:
    image: mysql
    ports:
    - "3306:3306"
    environment:
    MYSQL_DATABASE: myDb
    MYSQL_USER: user
    MYSQL_PASSWORD: test
    MYSQL_ROOT_PASSWORD: test
    volumes:
    - ./dump:/docker-entrypoint-initdb.d
    networks:
    - default
    phpmyadmin:
    image: phpmyadmin/phpmyadmin
    links:
    - db:db
    ports:
    - 8000:80
    environment:
    MYSQL_USER: user
    MYSQL_PASSWORD: test
    MYSQL_ROOT_PASSWORD: test
    volumes:
    - /sessions