Skip to content

Instantly share code, notes, and snippets.

@monochromer
Last active February 10, 2025 07:37
Show Gist options
  • Save monochromer/a050968533fa238f41bf3e658dc18031 to your computer and use it in GitHub Desktop.
Save monochromer/a050968533fa238f41bf3e658dc18031 to your computer and use it in GitHub Desktop.
Dockerfile for `lua` and `vips`

Dockerfile for lua and vips

docker build -t lua-vips .
docker run --rm -it \
  -v $PWD:/data \
  lua-vips:latest \
  lua main.lua
FROM alpine:3.21.0
RUN apk add --no-cache --update \
make \
gcc \
musl-dev
RUN apk add --no-cache --update \
vips \
vips-dev \
# cli tools if you need
vips-tools \
# avif support
vips-heif
RUN apk add --no-cache --update \
lua5.4 \
lua5.4-dev \
luajit \
luarocks \
luarocks5.4
RUN ln -s $(which lua5.4) /usr/bin/lua && \
ln -s $(which luarocks-5.4) /usr/bin/luarocks
RUN luarocks install lua-vips
WORKDIR /data
local vips = require 'vips';
local version = { vips.version.major, vips.version.minor, vips.version.micro };
print('vips version:', table.concat(version, '.'));
local image = vips.Image.new_from_file('image.jpg');
image:write_to_file('image.avif', { Q = 50 });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment