Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Official Flyway Dockerfile #797

Closed
ToBeReplaced opened this issue Jul 12, 2014 · 10 comments
Closed

Official Flyway Dockerfile #797

ToBeReplaced opened this issue Jul 12, 2014 · 10 comments

Comments

@ToBeReplaced
Copy link

Would you consider establishing and supporting a Dockerfile for running flyway?

Here is a complete example that I am using in my own projects:

FROM centos:centos7
MAINTAINER ToBeReplaced

# Get flyway
RUN ["curl", "-O", "http://repo1.maven.org/maven2/org/flywaydb/flyway-commandline/3.0/flyway-commandline-3.0.tar.gz"]
RUN ["yum", "install", "-y", "tar"]
RUN ["tar", "-xzf", "flyway-commandline-3.0.tar.gz"]

# Install java and the jdbc postgres driver
RUN ["yum", "install", "-y", "java-1.7.0-openjdk-headless"]
RUN ["yum", "install", "-y", "postgresql-jdbc"]

WORKDIR flyway-3.0

# Copy the postgres driver to its required location
RUN ["cp", "/usr/share/java/postgresql-jdbc.jar", "jars/"]

ENTRYPOINT ["./flyway"]

This allows you to run flyway inside of its own container. Example:

docker run --rm -v '/opt/migrations:/opt/migrations' org.tobereplaced/flyway migrate -user=postgres -url='jdbc:postgresql://172.17.0.5:5432/exampledb' -locations='filesystem:/opt/migrations'
@axelfontaine axelfontaine added this to the Flyway 3.2 milestone Sep 16, 2014
@axelfontaine
Copy link
Contributor

Thanks for the suggestion. I'll look into this past Flyway 3.1

@orlade
Copy link

orlade commented Apr 10, 2016

This would be great. A Flyway container could be started alongside the app container in Docker Compose, migrate the database at the injected hostname, then terminate totally independent of the app.

@supersonicclay
Copy link

You are welcome to use this as a starting point.
https://hub.docker.com/r/claycephas/flyway/

@dhoer
Copy link

dhoer commented Oct 4, 2016

@axelfontaine any chance we can get an official flyway repo in 2016?

@axelfontaine
Copy link
Contributor

@dhoer Would you be willing to contribute your Dockerfile?

@axelfontaine axelfontaine added this to the Flyway 5.0.0 milestone Aug 22, 2017
@dhoer
Copy link

dhoer commented Aug 22, 2017

@axelfontaine You bet! https://github.com/dhoer/docker-flyway

@mfilotto
Copy link

Any update on this one ?

axelfontaine pushed a commit to flyway/flywaydb.org that referenced this issue Dec 4, 2017
@axelfontaine
Copy link
Contributor

This is now available: https://hub.docker.com/r/boxfuse/flyway/

Thanks @dhoer for providing a nice starting point with your repo!

axelfontaine pushed a commit to flyway/flywaydb.org that referenced this issue Dec 4, 2017
@dhoer
Copy link

dhoer commented Dec 10, 2017

@axelfontaine Thanks for the official release!

I do have to ask about why volumes were added. It prevents extending the image cleanly e.g.,

FROM boxfuse/flyway:5.0.2

ENV MYSQL_DRIVER_VERSION 5.1.45

RUN curl -o /flyway/drivers/mysql-connector-java-${MYSQL_DRIVER_VERSION}.jar
    https://repo1.maven.org/maven2/mysql/mysql-connector-java/${MYSQL_DRIVER_VERSION}/mysql-connector-java-${MYSQL_DRIVER_VERSION}.jar

Unless there is a trick I don't know about, having volumes defined requires the use of multistage-build pattern, or repeating the entire contents of the dockerfile.

Can volumes be removed from the dockerfile? They are easy to add and usage can be documented in readme. But once they are there, base images are hard to extend.

@axelfontaine
Copy link
Contributor

@dhoer Good point. Fixed. In the future, please open a new issue against flyway/flyway-docker. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants