Docker based Lua library development

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Docker based Lua library development

Tobias Kieslich

Hi,

when building my own libraries I found it cumbersome to set up some framework
that allows me to run my stuff and and not install it locally which would have
contaminated the local installation.  Instead I used a custom patched version
of Lua that extended the package path to something relative of the Lua
executable (Windows allows that out of the box) and run it this way.  All this
was orchestrated by a rather magical Makefile.  It seemed cool at the time,
elegant even, but in all honesty it was pretty convoluted.

So I set up a Dockerfile that installs Lua(5.3) and mounts your current
directory into /build.  The inside of the docker container mimics being
installed like within a Linux distro.  You can modify the Dockerfile to use
Lua-5.4-work1 for example instead.  The mount of the local directory is
bind-based, so all editing can still happen on the host, then compile, install
within the container.  Debugging isn't really figured out yet.  Comments and
ideas are welcome, I hope someone finds it useful.

All attached files are meant to live inside the root directory of your Lua
project.

-tobbik

liblua.so.patch (1K) Download Attachment
lua.pc (447 bytes) Download Attachment
Dockerfile (1K) Download Attachment
Makefile (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Docker based Lua library development

Sean Conner
It was thus said that the Great [hidden email] once stated:

>
> Hi,
>
> when building my own libraries I found it cumbersome to set up some
> framework that allows me to run my stuff and and not install it locally
> which would have contaminated the local installation.  Instead I used a
> custom patched version of Lua that extended the package path to something
> relative of the Lua executable (Windows allows that out of the box) and
> run it this way.  All this was orchestrated by a rather magical Makefile.
> It seemed cool at the time, elegant even, but in all honesty it was pretty
> convoluted.

  So what's wrong with using the environment variables?

[spc]lucy:~>LUA_PATH_5_3="./?.lua" LUA_CPATH_5_3="./?.so" lua-53
Lua 5.3.4  Copyright (C) 1994-2017 Lua.org, PUC-Rio
> print(package.path)
./?.lua
> print(package.cpath)
./?.so
>

  -spc


Reply | Threaded
Open this post in threaded view
|

Re: Docker based Lua library development

Tobias Kieslich

Quoting Sean Conner <[hidden email]>:

> It was thus said that the Great [hidden email] once stated:
>>
>> Hi,
>>
>> when building my own libraries I found it cumbersome to set up some
>> framework that allows me to run my stuff and and not install it locally
>> which would have contaminated the local installation.  Instead I used a
>> custom patched version of Lua that extended the package path to something
>> relative of the Lua executable (Windows allows that out of the box) and
>> run it this way.  All this was orchestrated by a rather magical Makefile.
>> It seemed cool at the time, elegant even, but in all honesty it was pretty
>> convoluted.
>
>   So what's wrong with using the environment variables?

Nothing really. I just liked a version that was all self contained that could
be copied into any location and needed no external adjustments.  All things
considered the dockerized way is much better, especially since it allows me to
test network functionality in much more realistic scenarios.

-tobbik