elliotchance / vsql

✌️ Single-file or PostgreSQL-server compatible transactional SQL database written in pure V.
https://vsql.readthedocs.io
MIT License
299 stars 20 forks source link

Provide docker image #150

Closed elliotchance closed 1 year ago

elliotchance commented 1 year ago

As part of CI. In the mean time here is a way to build it:

VERSION=0.27.2

curl https://github.com/elliotchance/vsql/releases/download/v$VERSION/vsql-linux.zip --output vsql.zip
unzip vsql.zip

cat <<EOT >> Dockerfile
FROM alpine:3.14
RUN apk add gcompat
COPY vsql /usr/bin
ENTRYPOINT ["vsql"]
EOT

docker build -t vsql:$VERSION .

Interact with a file:

docker run -it vsql:$VERSION cli mydb.vsql

Unfortunaly, it looks like the vsql> prompt is misaligned with the input, so it does work but the formatting is all messed up:

elliotc@elliotc-C02FM0L1MD6R vsql % docker run -it vsql:$VERSION cli mydb.vsql
GC Warning: getcontext failed: using another register retrieval method...
vsql v0.27.2 2023-03-03
VALUES 1 + 2;
vsql> COL1: 3 
1 row (11 ms)

VALUES 'Hello, World!';
vsql> COL1: Hello, World! 
1 row (7 ms)

I'm not sure this is just a bug with the way it's packaged in docker.

You should also be able to start it as a PostgreSQL server with:

elliotc@elliotc-C02FM0L1MD6R vsql % docker run -it vsql:$VERSION server mydb.vsql
GC Warning: getcontext failed: using another register retrieval method...
vsql v0.27.2 2023-03-03
ready on 127.0.0.1:3210

Although, I didn't try connecting to it.