wodby / php

Generic PHP docker container images
MIT License
155 stars 103 forks source link

new .gitconfig is made in webroot #24

Closed michaelpporter closed 6 years ago

michaelpporter commented 6 years ago

I noticed in image: wodby/wordpress-php:7.0-4.2.4 a new file .gitconfig is added to my codebase.

[user]
        email = wodby@example.com
        name = wodby

I see the values in the Dockerfile

    GIT_USER_EMAIL="wodby@example.com" \
    GIT_USER_NAME="wodby"

Wondering why it is made when we have global settings and now have to add it to gitignore or provide variables to overwrite it. Each developer will have their own settings so it can not be added to a base config.

csandanov commented 6 years ago

We add global default git user email and name because some git operations we use in orchestration require those params to be set. Because they're global they've added to ~/.gitconfig, not sure how it ended up in your codebase.

michaelpporter commented 6 years ago

Here is my docker-compose.yml if you want to test.

version: "2"

services:
  mariadb:
    image: wodby/mariadb:10.1-3.1.3
    environment:
      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
      MYSQL_DATABASE: ${DATABASE_NAME}
      MYSQL_USER: ${DATABASE_USER}
      MYSQL_PASSWORD: ${DATABASE_PASSWORD}
    volumes:
      - ./mariadb-init:/docker-entrypoint-initdb.d # Place init .sql file(s) here.

  php:
    image: wodby/wordpress-php:7.0-4.2.4
    environment:
      PHP_SENDMAIL_PATH: /usr/sbin/sendmail -t -i -S mailhog:1025
      PHP_OUTPUT_BUFFERING: 'On'
      PHP_OUTPUT_HANDLER: mb_output_handler
      PHP_XDEBUG: 0
      PHP_XDEBUG_DEFAULT_ENABLE: 1
      PHP_XDEBUG_REMOTE_CONNECT_BACK: 0         # This is needed to respect remote.host setting bellow
      PHP_XDEBUG_REMOTE_HOST: "10.254.254.254"  # You will also need to 'sudo ifconfig lo0 alias 10.254.254.254'
    volumes:
      - ./:/var/www/html:cached # Docker-sync

  nginx:
    image: wodby/wordpress-nginx:4-1.13
    environment:
      NGINX_STATIC_CONTENT_OPEN_FILE_CACHE: "off"
      NGINX_ERROR_LOG_LEVEL: debug
      NGINX_BACKEND_HOST: php
      NGINX_SERVER_ROOT: /var/www/html/web
    volumes_from:
      - php
    depends_on:
      - php
    labels:
      - 'traefik.backend=${TRAEFIK_HOST}_nginx_1'
      - 'traefik.entrypoint=http'
      - 'traefik.enable=true'
      - 'traefik.port=80'
      - 'traefik.priority=10'
      - 'traefik.frontend.rule=Host:${TRAEFIK_HOST}.test'

  apache:
    image: wodby/php-apache:2.4-3.0.4
    depends_on:
      - php
    environment:
      APACHE_LOG_LEVEL: debug
      APACHE_BACKEND_HOST: php
      APACHE_SERVER_ROOT: /var/www/html/web
      HOME: /var/www/html/web
    volumes_from:
      - php
    labels:
      - 'traefik.backend=${TRAEFIK_HOST}_apache_1'
      - 'traefik.entrypoint=http'
      - 'traefik.enable=true'
      - 'traefik.port=80'
      - 'traefik.priority=50'
      - 'traefik.frontend.rule=Host:${TRAEFIK_HOST}.test;PathPrefix:/shop'

  phantomjs:
    image: wernight/phantomjs:2
    volumes_from:
      - php
    links:
      - apache
    ports:
      - 4444
    entrypoint: phantomjs
    command: "--webdriver=4444"

  mailhog:
    image: mailhog/mailhog
    labels:
      - 'traefik.backend=${TRAEFIK_HOST}_mailhog_1'
      - 'traefik.port=8025'
      - 'traefik.frontend.rule=Host:mailhog.${TRAEFIK_HOST}.test'

  adminer:
    image: wodby/adminer:4.3
    environment:
      ADMINER_SALT: adminer-salt
    labels:
      - 'traefik.backend=${TRAEFIK_HOST}_adminer_1'
      - 'traefik.port=9000'
      - 'traefik.frontend.rule=Host:adminer.${TRAEFIK_HOST}.test'

I think it is in php-apache...

Running this docker-compose.yml I get the .gitconfig file. Apologies for not testing more before making the ticket. I changes both php and php-apache at the same time and did s github search for wodby@example.com and php came up first.

version: "2"

services:
  apache:
    image: wodby/php-apache:2.4-3.0.4
    environment:
      APACHE_LOG_LEVEL: debug
      APACHE_BACKEND_HOST: php
      APACHE_SERVER_ROOT: /var/www/html/web
      HOME: /var/www/html/web
    volumes:
      - ./:/var/www/html:cached # Docker-sync
    labels:
      - 'traefik.backend=${TRAEFIK_HOST}_apache_1'
      - 'traefik.entrypoint=http'
      - 'traefik.enable=true'
      - 'traefik.port=80'
      - 'traefik.priority=50'
      - 'traefik.frontend.rule=Host:${TRAEFIK_HOST}.test;PathPrefix:/shop'
csandanov commented 6 years ago

Our image could add .gitconfig only if your global git config location is the current directory which I doubt is the case here