Skip to content

Commit d5e9763

Browse files
mlh758coderjoe
authored andcommitted
Add documentation about LD_LIBRARY_PATH in Docker (#420)
Make note that LD_LIBRARY_PATH may need to be modified if FreeTDS is built in its default configuration in Docker due to /usr/local/lib not being in the path. Closes #419
1 parent d8cb94e commit d5e9763

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ $ make
5050
$ make install
5151
```
5252

53-
If none exist, our native extension will use MiniPortile to install any missing dependencies listed above for your specific platform. These dependencies will be built and linked within the installed TinyTDS gem. Please read the MiniPortile and/or Windows sections at the end of this file for advanced configuration options past the following:
53+
Please read the MiniPortile and/or Windows sections at the end of this file for advanced configuration options past the following:
5454

5555
```
5656
--with-freetds-dir=DIR
@@ -73,7 +73,7 @@ TinyTDS is developed against FreeTDS 0.95, 0.99, and 1.0 current. Our default an
7373

7474
**NOTE:** Windows users of our pre-compiled native gems need not worry about installing FreeTDS and its dependencies.
7575

76-
* **Do I need to install FreeTDS?** Yes! Somehow, someway, you are going to need FreeTDS for TinyTDS to compile against. You can avoid installing FreeTDS on your system by using our projects usage of rake-compiler and mini_portile to compile and package a native gem just for you. See the "Using MiniPortile" section below.
76+
* **Do I need to install FreeTDS?** Yes! Somehow, someway, you are going to need FreeTDS for TinyTDS to compile against.
7777

7878
* **OK, I am installing FreeTDS, how do I configure it?** Contrary to what most people think, you do not need to specially configure FreeTDS in any way for client libraries like TinyTDS to use it. About the only requirement is that you compile it with libiconv for proper encoding support. FreeTDS must also be compiled with OpenSSL (or the like) to use it with Azure. See the "Using TinyTDS with Azure" section below for more info.
7979

@@ -466,6 +466,17 @@ $ rake TINYTDS_UNIT_HOST=mydb.host.net TINYTDS_SCHEMA=sqlserver_azure
466466
$ rake TINYTDS_UNIT_HOST=mydb.host.net TINYTDS_UNIT_PORT=5000 TINYTDS_SCHEMA=sybase_ase
467467
```
468468

469+
## Docker Builds
470+
471+
If you use a [multi stage](https://docs.docker.com/develop/develop-images/multistage-build/) Docker build to assemble your gems in one phase and then copy your app and gems
472+
into another, lighter, container without build tools you will need to make sure you tell the OS how to find dependencies for TinyTDS.
473+
474+
After you have built and installed FreeTDS it will normally place library files in `/usr/local/lib`. When TinyTDS builds native extensions,
475+
it [already knows to look here](https://github.com/rails-sqlserver/tiny_tds/blob/master/ext/tiny_tds/extconf.rb#L31) but if you copy your app to a new container that link will be broken.
476+
477+
Set the LD_LIBRARY_PATH environment variable `export LD_LIBRARY_PATH=/usr/local/lib:${LD_LIBRARY_PATH}` and run `ldconfig`. If you run `ldd tiny_tds.so` you should not see any broken links. Make
478+
sure you also copied in the library dependencies from your build container with a command like `COPY --from=builder /usr/local/lib /usr/local/lib`.
479+
469480
## Help & Support
470481

471482
* Github Source: http://github.com/rails-sqlserver/tiny_tds

0 commit comments

Comments
 (0)