diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 0d760a06..dc20676e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -304,6 +304,7 @@ jobs: uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0 with: context: . + file: docker/Dockerfile push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/README.md b/README.md index 1720fad7..44d695aa 100644 --- a/README.md +++ b/README.md @@ -166,7 +166,7 @@ sudo dnf install mycli fzf python-pygments The images on Dockerhub are out of date. ghcr.io is preferred. Example: ``` -docker run --pull=always -it ghcr.io/dbcli/mycli:latest mycli --help +docker run --pull=always -it ghcr.io/dbcli/mycli:latest ``` ### Windows diff --git a/changelog.md b/changelog.md index 901785eb..d1836d25 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,11 @@ Upcoming (TBD) ============== +Features +-------- +* Include a MariaDB server and example data in the Docker image. + + Documentation -------- * Add `--pull=always` to documented `docker run` command. diff --git a/Dockerfile b/docker/Dockerfile similarity index 55% rename from Dockerfile rename to docker/Dockerfile index 1ddd3254..bb6db476 100644 --- a/Dockerfile +++ b/docker/Dockerfile @@ -5,6 +5,7 @@ ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update -qq && \ apt-get install -y --no-install-recommends --no-install-suggests -qq \ fzf \ + mariadb-server \ && \ apt-get clean autoclean && \ apt-get autoremove --yes && \ @@ -12,6 +13,14 @@ RUN apt-get update -qq && \ COPY . /app +RUN service mariadb restart && \ + cd /app/docker/resources && \ + gunzip -c test_db-1.0.7.tar.gz | tar -xf - && \ + cd test_db && \ + mariadb < employees.sql && \ + cd .. && \ + rm -r -- ./test_db + RUN cd /app && pip install --root-user-action=ignore -e .[llm,dataframe] -CMD ["mycli", "--help"] +CMD ["sh", "-c", "service mariadb start && mycli --database employees"] diff --git a/docker/resources/test_db-1.0.7.tar.gz b/docker/resources/test_db-1.0.7.tar.gz new file mode 100644 index 00000000..eae1d041 Binary files /dev/null and b/docker/resources/test_db-1.0.7.tar.gz differ