Created
August 1, 2017 08:58
-
-
Save matt-halliday/ee0eb2e1acf8c34e1c929b80251b49f3 to your computer and use it in GitHub Desktop.
Ensure MySQL is ready without some dirty bash script trying to connect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "2.1" | |
services: | |
app: | |
build: | |
dockerfile: ./build/docker/app/Dockerfile | |
context: . | |
env_file: | |
- ./build/docker/app/app.env | |
- ./build/docker/mysql/mysql.env | |
extra_hosts: | |
- app.docker:127.0.0.1 | |
ports: | |
- 80:80 | |
restart: always | |
depends_on: | |
db: | |
condition: service_healthy | |
db: | |
build: | |
dockerfile: ./build/docker/mysql/Dockerfile | |
context: . | |
env_file: | |
- ./build/docker/mysql/mysql.env | |
ports: | |
- 3306:3306 | |
healthcheck: | |
test: ["CMD", "nc", "-z", "localhost", "3306"] | |
interval: 2s | |
timeout: 3s | |
retries: 15 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM mysql:5.7.16 | |
RUN apt-get update \ | |
&& apt install -y netcat \ | |
&& apt-get clean && apt-get purge \ | |
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment