mysqlmacosubuntukitura

How to use SwiftMySQLKuery with tools-utils.sh on the official swift-ubuntu image?


I'm trying to run a release build of my kitura (2.7) app with mysql on the official swift-ubuntu (latest, 5.0.1) image with the following commands.

docker build --no-cache -t my-app-build -f Dockerfile-tools .
docker run -v $PWD:/swift-project -w /swift-project my-app-build /swift-utils/tools-utils.sh build release

First command one is working as expected. Second one is giving a warning:

warning: you may be able to install mysqlclient using your system-packager: apt-get install libmysqlclient-dev

Tried to install the lib but nothing changed...

Can someone help me?

Thanks in advance!


Solution

  • The issue appears to be related to the version of Ubuntu and the resulting level of MySQL that is installed. As the base container is running Ubuntu 14.04 when MySQL installs you get version 5.5 which does not ship the required configuration for pkg-config to find the include paths needed to build your application.

    I have been able to get a simple Kitura application which uses SwiftKueryMySQL to build under docker by updating my Dockerfile-tools file with two changes:

    1) Update the FROM to:

    FROM swift:5.0.1
    

    2) Add some required packages:

    # Install system level packages
    RUN apt-get update && apt-get install -y sudo libcurl4-openssl-dev openssl libssl-dev pkg-config libmysqlclient-dev
    

    With these updates your build should succeed. I will look into a longer term solution to the issue.