Skip to content

Commit

Permalink
Docker Build Publishing (Develop+Prod) (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
JFryy authored Jun 27, 2024
1 parent e7b6dff commit c515a1d
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 18 deletions.
28 changes: 20 additions & 8 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
name: Docker Image CI
name: ci

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
branches:
- 'main'
#TODO: handling
#- 'develop'

jobs:
build:
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build the Docker image
run: docker build . --file Dockerfile --tag jfryy/qq:$(date +%s)
- uses: actions/checkout@v3
name: Check out code

- uses: mr-smithers-excellent/docker-build-push@v6
name: Build & push Docker image
with:
image: jfryy/qq
tags: v1, latest
multiPlatform: true
registry: registry.hub.docker.com
dockerfile: Dockerfile
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
8 changes: 3 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
FROM golang:1.22 as builder

WORKDIR /app
COPY ./ ./
RUN go mod tidy
WORKDIR /qq
COPY . .
ENV CGO_ENABLED 0
RUN make build
RUN apt update -y && apt install jq -y && make test

FROM gcr.io/distroless/static:debug

COPY --from=builder /app/bin/qq /
COPY --from=builder /qq/bin/qq /
ENTRYPOINT ["/qq"]
CMD ["--help"]
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ install: test
perf: build
time "./tests/test.sh"

.PHONY: all test clean
.PHONY: all test clean publish

19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
Basic usage:
<a href="https://asciinema.org/a/665317" target="_blank"><img src="https://asciinema.org/a/665317.svg" /></a>



```sh
# query file and infer format from extension
qq .foo.bar file.xml
# JSON is default in
cat file.${ext} | qq -i ${ext}

# query file through pipe, transcode xml -> terraform (it can be done but it probably shouldn't)
cat file.xml | qq '.bar.foo[].meep' -i xml -o tf
# query xml, grep with gron using qq io
qq file.xml -o gron | grep -vE "sweet.potatoes" | qq -i gron

# interactive query builder mode on target file
qq . file.toml --interactive
Expand All @@ -29,6 +31,15 @@ make install

Download at releases [here](https://github.com/JFryy/qq/releases).

Docker quickstart:

```shell
# install the image
docker pull jfryy/qq

# run an example
echo '{"foo":"bar"}' | docker run -i jfryy/qq '.foo = "bazz"' -o tf
```
## Background

`qq` is inspired by `fq` and `jq`. `jq` is a powerful and succinct query tool, sometimes I would find myself needing to use another bespoke tool for another format than json, whether its something dedicated with json query built in or a simple converter from one configuration format to json to pipe into jq. `qq` aims to be the only utility needed for most interaction with structured formats in the terminal. It can transcode configuration formats interchangeably between one-another with the power of `jq` and it has an `an interactive repl (with automcomplete)` to boot so you can have an interactive experience when building queries optionally. Many thanks to the authors of the libraries used in this project, especially `jq`, `gojq`, and `fq` for direct usage or inspiration for the project.
Expand Down

0 comments on commit c515a1d

Please sign in to comment.