flyway/flyway-docker

Arm based images

pixie79 opened this issue ยท 24 comments

Hi,

I would be good if you could also build arm64 based images which is becoming more common across the Kube/Docker estate by default.

We tend to test our work on mini Raspberry Pi clusters and ideally being able to run this would be great.

Thanks

Hi. We will likely wait until Docker Hub supports this as part of their automated builds without requiring us to copy qemu in

You could use the Dockerfile to build your own arm64 images for now

Docker Hub does support this now, I currently build my other images based off of the small ubuntu but then all i do it

  build:
    needs: [test]
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Setup Docker Buildx
        uses: docker/setup-buildx-action@v1
      - name: Set up QEMU
        uses: docker/setup-qemu-action@v1
      - name: Login to DockerHub
        uses: docker/login-action@v1
        with:
          username: ${{ secrets.DOCKER_USERNAME }}
          password: ${{ secrets.DOCKER_PASSWORD }}
      - name: Build and push
        id: docker_build
        uses: docker/build-push-action@v2
        with:
          push: true
          platforms: linux/arm/v7,linux/arm64/v8,linux/amd64
          tags: "xxx:latest,xxx:${{ github.sha }}"
      - uses: 8398a7/action-slack@v2
        with:
          status: ${{ job.status }}
          author_name: Github # default: 8398a7@action-slack
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # optional
          SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required
        if: always() # Pick up events even if the job fails or is canceled.

The use of Github actions makes it very easy.

I have looked at building the main flyway repo which looks easy enough - but i am not sure where the "flyway" command get built all i see is the flyway-command jar, do you wrap it somewhere or have another build step?

Happy to attempt a PR to build a multi platform container if i know where that bit comes from.

Thanks

Mark

This builds the image as part of the GitHub action as opposed to using Docker Hub's automated builds. We may move to this depending on how much interest this gets, so will leave this open for now

If i try to run the flyway in the flyway-command dir I just get the following:
root@c94dd58f822a:/tmp# ./flyway
Error: Unable to initialize main class org.flywaydb.commandline.Main
Caused by: java.lang.NoClassDefFoundError: org/flywaydb/core/api/logging/LogCreator

I tried to replicate what you have in the current docker; lib/community/flyway-commandline.jar and conf/flyway.conf

All the pieces look the same but i guess i missed a step. I just seem to not be able to work out how to go from the maven build to the Tar file you publish?

The script snippet i gave above is a github action. - not a Docker hub build - it just published to dockerhub

Is there a particular reason you need to build Flyway from source for this, as opposed to getting the artifact from Maven as the existing Dockerfiles do?

Um yes you do not have a multi arch Docker image. Currently I take the published docker image and use that with in our image to then include our deployments.

We are needing to support cross platform deployment and as such the easiest way is if the base image supports arm64 & amd64.

I must have been looking at something else as i thought the mvn release you did was arch dependant - but i see now i dont think it is - as such i will just attempt to pull that in as you do here.

btw why do you not have this dockerfile in the main repo?

+1 for an ARM / RPi image. @pixie79 did u end creating the said image?

ijohn commented

Running flyway/flyway:latest image on Tech Preview of Docker Desktop for M1 Mac results in the following:

qemu: uncaught target signal 11 (Segmentation fault) - core dumped
/flyway/flyway: line 83:    18 Segmentation fault      "$JAVA_CMD" $JAVA_ARGS $EXTRA_ARGS -cp "$CP" org.flywaydb.commandline.Main "$@"

If I take the Dockerfile from this repo and change the base image to adoptopenjdk:11-jre-hotspot-bionic (that supports ARM) I'm able to run flyway in my Pi 3. Maybe we could consider changing the base image to support ARM too?

alnr commented

I would also be interested in an arm64 image. I guess only the automated build for Docker hub would need to be reconfigured?

Running docker buildx build --platform=linux/arm64 . on master in this repo builds the native arm64 image without any changes necessary.

Here is a guide to using Github actions to build your images as multi-arch: https://www.docker.com/blog/multi-arch-build-and-images-the-simple-way/

I would also be interested in an arm64 image. I guess only the automated build for Docker hub would need to be reconfigured?

Running docker buildx build --platform=linux/arm64 . on master in this repo builds the native arm64 image without any changes necessary.

+1 to multi-arch support from me!

Yeah, I'm looking to run this natively on an M1 Mac, so arm64 support would be great

I am also looking for this! Flyway fails intermittently on my M1 MBP when using the linux/amd64 image.

me too

Looking forward for the Arm64 image, it'd be useful a lot!

+1 for arm support

Thanks for all the interest!

The flyway/flyway image is now multi-arch. The platforms supported are linux/arm/v7, linux/arm64/v8 and linux/amd64

working in .devcontainer I had to install flyway cli in my Dockerfile
RUN wget -qO- https://repo1.maven.org/maven2/org/flywaydb/flyway-commandline/8.5.4/flyway-commandline-8.5.4-linux-x64.tar.gz | tar xvz && sudo ln -s pwd/flyway-8.5.4/flyway /usr/local/bin

and when I use inside the environment I have this
Screenshot 2022-03-21 at 09 10 41