Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Docker build #461

Open
nightscape opened this issue Nov 22, 2021 · 2 comments
Open

Add Docker build #461

nightscape opened this issue Nov 22, 2021 · 2 comments

Comments

@nightscape
Copy link

It would be nice if sqlline were published by the official owner @julianhyde.
There are some sqlline images on Docker Hub, but none of those is frequently updated and when using an image from a third party, one in principle always has to check if they're doing anything malicious.
I would propose to add this Dockerfile (which is the most recently updated one) to this repo.
In a second optional step Github Actions could be used to automatically build and push an updated version whenever the code changes.

@julianhyde
Copy link
Owner

Can you submit a PR? (What you are suggesting is nice, but we're all volunteers here.)

@snuyanzin
Copy link
Collaborator

snuyanzin commented Nov 23, 2021

I like the idea of having docker file and publishing images on Docker Hub.
The issue with the mentioned Dockerfile is that it installs sqlline from Debian packages and right now only a very old sqlline is available there...
So probably need to go a bit different way
By accident I noticed that sqlline account name on Docker Hub was free => I started to use and published a docker image for bare sqlline-1.12.0 (without any driver) [1]
Also I created a Dockerfile with drivers for Postgresql, MySql, ClickHouse[2] - those that I was able to check that they are working.

By the way here it is a docker-compose.yml which could be used for testing

version: '3.3'
services:
  sqlline:
    container_name: sqlline
    image: 'sqlline/sqlline:1.12.0-pg-my-cl'
    stdin_open: true
    tty: true
  postgres:
    container_name: pg
    image: 'postgres:14.0'
    ports:
      - 5432:5432
    environment:
      POSTGRES_PASSWORD: 'postgres'
  mysql:
    image: 'mysql:8.0.27'
    ports:
      - 3306:3306
    environment:
      MYSQL_DATABASE: 'db'
      MYSQL_USER: 'user'
      MYSQL_PASSWORD: 'password'
      MYSQL_ROOT_PASSWORD: 'password'
  clickhouse:
    image: 'yandex/clickhouse-server:21.8.11.4'
    ports:
      - 8123:8123
    environment:
      CLICKHOUSE_DB: my_db_name
      CLICKHOUSE_USER: clickhouse-user
      CLICKHOUSE_PASSWORD: secret

To start - save it in a docker-compose.yml and in the same dir

docker-compose up -d
docker exec -it sqlline sqlline

and now sqlline should welcome
to test connections

!connect jdbc:postgresql://pg:5432/postgres postgres postgres
!connect jdbc:mysql://mysql:3306/db?autoReconnect=true user password
!connect jdbc:clickhouse://ch:8123/my_db_name clickhouse-user secret

!all select 1;

So it is still more like a sandbox => other ideas, contributions are welcome.
Current docker files are available at [3]

[1] https://hub.docker.com/layers/178760163/sqlline/sqlline/1.12.0/images/sha256-1be56e2dfd205a882b11072a6cda2d1242f868878e6723d54d991bd4c64a2f2e?context=repo
[2] https://hub.docker.com/layers/178790407/sqlline/sqlline/1.12.0-pg-my-cl/images/sha256-389ff61ce275c62fe77b1c4893cfd32dd8f444f6283f90cac2e557cda53fed9c?context=repo
[3] snuyanzin@03b4303

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants