Skip to content

Commit

Permalink
Adding Docker (#151)
Browse files Browse the repository at this point in the history
Releases will now push a docker image. This is a really easy way to get
up and running:

    docker run -it elliotchance/vsql:latest cli mydb.vsql

Fixes #150
  • Loading branch information
elliotchance committed Mar 4, 2023
1 parent e423a6e commit 170d1fc
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 11 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: CI
on:
push:
paths-ignore:
- '**.md'
- '**.rst'
- "**.md"
- "**.rst"
pull_request:
paths-ignore:
- "**.md"
Expand Down Expand Up @@ -60,7 +60,6 @@ jobs:
id: v
v-version: master


- name: Build macOS binaries
run: |
.github/workflows/set_version.sh
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Publish Docker image

on:
release:
types: [published]

jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3

- name: Set up V version latest
uses: nocturlab/setup-vlang-action@v1
with:
id: v
v-version: master

- name: Build linux binaries
run: |
.github/workflows/set_version.sh
make bin/vsql
VERSION=${GITHUB_REF##*/}
TAGS="elliotchance/vsql:${VERSION:1},elliotchance/vsql:$(echo ${VERSION:1} | cut -d. -f-2),elliotchance/vsql:$(echo ${VERSION:1} | cut -d. -f-1),elliotchance/vsql:latest"
echo $TAGS
- name: Log in to Docker Hub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
username: elliotchance
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
tags: "${TAGS}"
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM alpine:3.14
RUN apk add gcompat
COPY bin/vsql /usr/bin
ENTRYPOINT ["vsql"]
59 changes: 51 additions & 8 deletions docs/install.rst
Original file line number Diff line number Diff line change
@@ -1,18 +1,61 @@
Installing & Updating
=====================

vsql can be installed or updated using `V <https://vlang.io>`_:
There are lots of ways to install vsql depending on how you want to use it.

Docker
------

Docker is the easiest way to get up and running (if you have
`Docker installed <https://docs.docker.com/get-docker/>`_.). Pull the latest
stable version with:

.. code-block:: sh
docker pull elliotchance/vsql:latest
You can also use major (``0``), minor (``0.27``) or patch versions (``0.27.1``).
View all versions on
`hub.docker.com/repository/docker/elliotchance/vsql/tags <https://hub.docker.com/repository/docker/elliotchance/vsql/tags?page=1&ordering=last_updated>`_.

Run the CLI directly (see :doc:`cli`):

.. code-block:: sh
docker run -it elliotchance/vsql:latest cli mydb.vsql
Or, start the PostgreSQL-compatible server (see :doc:`server`):

.. code-block:: sh
docker run -it elliotchance/vsql:latest server mydb.vsql
Prebuilt Binaries
-----------------

This is the best way to use vsql on most platforms without any dependencies.

Prebuilt binaries for macOS, Windows and Linux are available on the
`GitHub Releases Page <https://github.com/elliotchance/vsql/releases>`_.

V Package Manager
-----------------

This is the best method if you intend to build V applications using it as a
library. See `v-client-library`.

.. code-block:: sh
v install elliotchance.vsql
Or, if you don't have V installed you can also download standalone binaries from
the `Releases <https://github.com/elliotchance/vsql/releases>`_.
Compiling From Source
---------------------

See Also
--------
This is the best choice if you want to modify vsql source or contribute to the
project. See :doc:`contributing`:

.. code-block:: sh
- :doc:`cli`
- :doc:`contributing`
- :doc:`v-client-library`
git clone https://github.com/elliotchance/vsql.git
cd vsql
make bin/vsql

0 comments on commit 170d1fc

Please sign in to comment.