Coder Social home page Coder Social logo

dhoer / docker-flyway Goto Github PK

View Code? Open in Web Editor NEW
29.0 5.0 7.0 51 KB

Dockerized flyway command-line tool with MySQL (Connector/J) JDBC Driver

Home Page: https://flywaydb.org

License: Apache License 2.0

Dockerfile 100.00%
docker flyway mysql jdbc-driver

docker-flyway's Introduction

Docker Flyway

Docker Auto Build travis

Extends Official Flyway Command-line Docker images to use MySQL Connector/J driver instead of MariaDB Connector/J driver for jdbc:mysql: connections.

Supported tags and respective Dockerfile links

Getting started

docker run dhoer/flyway:alpine [flyway cli arguments here]

Example

Add a file named V1__Initial.sql with following contents:

CREATE TABLE MyTable (
    MyColumn VARCHAR(100) NOT NULL
);

Linux

docker run --rm -v $(pwd):/flyway/sql dhoer/flyway:alpine -url=jdbc:mysql://mydb -schemas=myschema -user=root -password=P@ssw0rd migrate

Windows 10 (Docker for Windows)

CMD:

docker run --rm -v %cd%:/flyway/sql dhoer/flyway:alpine -url=jdbc:mysql://mydb -schemas=myschema -user=root -password=P@ssw0rd migrate

PowerShell:

docker run --rm -v C:\FolderWhereYourScriptsReside:/flyway/sql dhoer/flyway:alpine -url=jdbc:mysql://mydb -schemas=myschema -user=root -password=P@ssw0rd migrate

Windows 7 (Docker Toolbox)

docker run --rm -v /c/Users/FolderWhereYourScriptsReside:/flyway/sql dhoer/flyway:alpine -url=jdbc:mysql://mydb -schemas=myschema -user=root -password=P@ssw0rd migrate

Example docker-compose.yml

To run both Flyway and the database that will be migrated in containers, you can use a docker-compose.yml file that starts and links both containers.

version: '3'
services:
  flyway:
    image: dhoer/flyway:alpine
    command: -url=jdbc:mysql://db -schemas=myschema -user=root -password=P@ssw0rd migrate
    volumes:
      - .:/flyway/sql
    depends_on:
      - db
  db:
    image: mysql
    environment:
      - MYSQL_ROOT_PASSWORD=P@ssw0rd
    command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
    ports:
      - 3306:3306

Run docker-compose up -d db, wait a minute for MySQL to be initialized (or tail logs with docker-compose logs -f) then run docker-compose up flyway.

docker-flyway's People

Contributors

dhoer avatar thomaspaulin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

docker-flyway's Issues

Postgresql documentation

We have used this image for use with a Postgresql database and it works but seems to be excluded form the documentation, maybe you want to update your documentation to include them :)

container should poll until mysql is alive or until timeout occurs

Hey there,

I am running the example docker compose, and while I understand we must wait til the database is alive before running flyway, this is something I would assume that this container would handle for me.

I would like docker-compose up to have the flyway container poll for mysql for say... 120 seconds before erroring about not being able to find mysql. What do you think?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.