maurobonfietti / slim4-api-skeleton

Useful skeleton for RESTful API development with PHP and Slim 4.
http://bit.ly/2nNNOZi
MIT License
132 stars 32 forks source link

slim4-api-skeleton as docker container without mysql in container #27

Closed StephanKrauss closed 4 years ago

StephanKrauss commented 4 years ago

Hello,

i'm a beginner in docker. This is my first test with slim4-api-skeleton. I will use the slim4-api-skeleton in a container. When i start docker-compose i see in the container is a maysql database. Is there a way to use a external mysql database ?

Your sincerly

Stephan

GoldraK commented 4 years ago

Hi, You only need change the config in .env file with your data.

DB_HOST='127.0.0.1'
DB_NAME='slim4_api_skeleton'
DB_USER='root'
DB_PASS=''

And delete this lines in docker-compose.yml

mysql:
    image: mysql:5.7
    ports:
      - 33060:3306
    environment:
      MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
      MYSQL_DATABASE: slim4_api_skeleton
      MYSQL_USER: root
      MYSQL_PASSWORD: 
      MYSQL_ROOT_PASSWORD: 
    networks:
      - testingnetwork
    volumes:
      - my-data:/var/lib/mysql
maurobonfietti commented 4 years ago

Hi @StephanKrauss,

As @GoldraK says, you should update the config in your .env file.

Lastly, delete those lines in your docker-compose.yml.