# This Dockerfile can be used to test the WebAssembly udf build
# of libSQL.
# Build with `docker build -t libsql-wasm-udf -f Dockerfile-wasm-udf`
# Run e.g. with `docker run -it libsql-wasm-udf`
# or with `docker run -it -v.:/home/libsql/playground libsql-wasm-udf ./sqlite3 playground/db.sql`
# for an interactive session with the database being preserved on host in the db.sql file.

FROM rust:slim-buster

WORKDIR /home/libsql
ADD src src
ADD ext ext
ADD tool tool
ADD VERSION LIBSQL_VERSION

RUN apt-get update
RUN apt-get install -y tcl8.6-dev build-essential autoconf

# To make the build system happy
RUN ln -s /bin/grep /usr/bin/grep
RUN ln -s /bin/sed /usr/bin/sed
RUN ln -sf /bin/bash /bin/sh

COPY manifest manifest.uuid VERSION configure.ac Makefile.in \
    libtool sqlite3.pc.in sqlite_cfg.h.in install-sh config.guess config.sub ltmain.sh .

RUN autoconf
RUN ./configure --enable-wasm-runtime --enable-releasemode --enable-all
RUN make