Skip to content

Commit 9604e11

Browse files
committed
updated docker build to registry
1 parent 46ba652 commit 9604e11

File tree

4 files changed

+44
-19
lines changed

4 files changed

+44
-19
lines changed

.github/workflows/docker-image.yml

+20-8
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
1-
name: Docker Image CI
1+
name: ci
2+
3+
# future: develop branch no push
24
on:
35
push:
4-
branches: [ "main" ]
5-
pull_request:
6-
branches: [ "main" ]
6+
branches:
7+
- 'main'
8+
- 'develop'
79

810
jobs:
9-
build:
11+
docker:
1012
runs-on: ubuntu-latest
1113
steps:
12-
- uses: actions/checkout@v4
13-
- name: Build the Docker image
14-
run: docker build . --file Dockerfile --tag jfryy/qq:$(date +%s)
14+
- uses: actions/checkout@v3
15+
name: Check out code
16+
17+
- uses: mr-smithers-excellent/docker-build-push@v6
18+
name: Build & push Docker image
19+
with:
20+
image: jfryy/qq
21+
tags: v1, latest
22+
multiPlatform: true
23+
registry: registry.hub.docker.com
24+
dockerfile: Dockerfile
25+
username: ${{ secrets.DOCKER_USERNAME }}
26+
password: ${{ secrets.DOCKER_PASSWORD }}

Dockerfile

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
FROM golang:1.22 as builder
22

3-
WORKDIR /app
4-
COPY ./ ./
5-
RUN go mod tidy
3+
WORKDIR /qq
64
COPY . .
75
ENV CGO_ENABLED 0
8-
RUN make build
6+
RUN go mod download && go mod verify
7+
RUN apt update -y && apt install jq -y && make publish
98

109
FROM gcr.io/distroless/static:debug
1110

12-
COPY --from=builder /app/bin/qq /
11+
COPY --from=builder /qq/bin/qq /
1312
ENTRYPOINT ["/qq"]
14-
CMD ["--help"]

Makefile

+5-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ build:
1111
test: build
1212
./tests/test.sh
1313

14+
publish:
15+
./tests/test.sh
16+
go build -o bin/$(BINARY) $(SRC)
17+
1418
clean:
1519
rm bin/$(BINARY)
1620

@@ -21,5 +25,5 @@ install: test
2125
perf: build
2226
time "./tests/test.sh"
2327

24-
.PHONY: all test clean
28+
.PHONY: all test clean publish
2529

README.md

+15-4
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@
66
Basic usage:
77
<a href="https://asciinema.org/a/665317" target="_blank"><img src="https://asciinema.org/a/665317.svg" /></a>
88

9+
10+
911
```sh
10-
# query file and infer format from extension
11-
qq .foo.bar file.xml
12+
# JSON is default in
13+
cat file.${ext} | qq -i ${ext}
1214

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

1618
# interactive query builder mode on target file
1719
qq . file.toml --interactive
@@ -26,6 +28,15 @@ make install
2628

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

31+
Docker quickstart:
32+
33+
```shell
34+
# install the image
35+
docker pull jfryy/qq
36+
37+
# run an example
38+
echo '{"foo":"bar"}' | docker run -i jfryy/qq '.foo = "bazz"' -o tf
39+
```
2940
## Background
3041

3142
`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.

0 commit comments

Comments
 (0)