Skip to content

Instantly share code, notes, and snippets.

@lcdss
Last active January 14, 2019 12:04
Show Gist options
  • Save lcdss/f79f8cd996eb8f7d1e77ac7e63c60310 to your computer and use it in GitHub Desktop.
Save lcdss/f79f8cd996eb8f7d1e77ac7e63c60310 to your computer and use it in GitHub Desktop.

Revisions

  1. lcdss revised this gist Nov 11, 2018. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions history
    Original file line number Diff line number Diff line change
    @@ -44,6 +44,10 @@ docker-php-ext-install opcache
    sysctl net.ipv4.conf.all.forwarding=1
    iptables -P FORWARD ACCEPT

    # Problems to solve
    folders permissions - maybe using the same user/group when running the container
    auto install some extensions inside php container - exists a faster solution than creating a custom Dockerfile?

    # Alias / Functions
    composer () {
    tty=
  2. lcdss revised this gist Nov 11, 2018. 1 changed file with 11 additions and 0 deletions.
    11 changes: 11 additions & 0 deletions history
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,14 @@
    - docker
    - www
    - app1
    - app2
    - config
    - nginx
    - logs
    - nginx
    - data
    - mariadb

    docker run -itd \
    --restart unless-stopped \
    --name nginx \
  3. lcdss revised this gist Nov 11, 2018. 1 changed file with 51 additions and 6 deletions.
    57 changes: 51 additions & 6 deletions history
    Original file line number Diff line number Diff line change
    @@ -25,10 +25,55 @@ docker run -itd \
    -e MYSQL_DATABASE=dbname \
    mariadb

    PHP Extensions
    docker-php-ext-install pdo_mysql
    docker-php-ext-install opcache
    # PHP Extensions
    docker-php-ext-install pdo_mysql
    docker-php-ext-install opcache

    Not confirmed if it is necessary
    sysctl net.ipv4.conf.all.forwarding=1
    iptables -P FORWARD ACCEPT
    # Not confirmed if it is necessary
    sysctl net.ipv4.conf.all.forwarding=1
    iptables -P FORWARD ACCEPT

    # Alias / Functions
    composer () {
    tty=
    tty -s && tty=--tty
    docker run \
    $tty \
    --interactive \
    --rm \
    --user $(id -u):$(id -g) \
    --volume /etc/passwd:/etc/passwd:ro \
    --volume /etc/group:/etc/group:ro \
    --volume $(pwd):/app \
    composer "$@"
    }

    npm () {
    tty=
    tty -s && tty=--tty
    docker run \
    $tty \
    --interactive \
    --rm \
    -w /usr/src/app \
    --user $(id -u):$(id -g) \
    --volume /etc/passwd:/etc/passwd:ro \
    --volume /etc/group:/etc/group:ro \
    --volume $(pwd):/usr/src/app \
    node:alpine npm --no-cache "$@"
    }

    php () {
    tty=
    tty -s && tty=--tty
    docker run \
    $tty \
    --interactive \
    --rm \
    -w /usr/src/app \
    --user $(id -u):$(id -g) \
    --volume /etc/passwd:/etc/passwd:ro \
    --volume /etc/group:/etc/group:ro \
    --volume $(pwd):/usr/src/app \
    php:alpine "$@"
    }
  4. lcdss revised this gist Nov 11, 2018. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion history
    Original file line number Diff line number Diff line change
    @@ -27,4 +27,8 @@ docker run -itd \

    PHP Extensions
    docker-php-ext-install pdo_mysql
    docker-php-ext-install opcache
    docker-php-ext-install opcache

    Not confirmed if it is necessary
    sysctl net.ipv4.conf.all.forwarding=1
    iptables -P FORWARD ACCEPT
  5. lcdss revised this gist Nov 11, 2018. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion history
    Original file line number Diff line number Diff line change
    @@ -23,4 +23,8 @@ docker run -itd \
    --network backend \
    -e MYSQL_ROOT_PASSWORD=secret \
    -e MYSQL_DATABASE=dbname \
    mariadb
    mariadb

    PHP Extensions
    docker-php-ext-install pdo_mysql
    docker-php-ext-install opcache
  6. lcdss created this gist Nov 11, 2018.
    26 changes: 26 additions & 0 deletions history
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    docker run -itd \
    --restart unless-stopped \
    --name nginx \
    --network backend \
    -p 80:80 \
    -p 443:443 \
    -v ~/docker/www:/var/www \
    -v ~/docker/config/nginx:/etc/nginx/conf.d \
    -w /var/www \
    nginx:alpine

    docker run -itd \
    --restart unless-stopped \
    --name php \
    --network backend \
    -v ~/docker/www:/var/www \
    -w /var/www \
    php:fpm-alpine

    docker run -itd \
    --restart unless-stopped \
    --name mariadb \
    --network backend \
    -e MYSQL_ROOT_PASSWORD=secret \
    -e MYSQL_DATABASE=dbname \
    mariadb