Skip to content

Commit 61ca39f

Browse files
committed
Add explicit binary version and resurrect "bashbrew.sh" for helping users compile from source
1 parent 173e6d7 commit 61ca39f

File tree

8 files changed

+27
-6
lines changed

8 files changed

+27
-6
lines changed

.dockerignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
**
2+
!bashbrew.sh
23
!cmd/
34
!go.mod
45
!go.sum

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
run: |
2121
docker build --tag bashbrew --pull .
2222
docker run --rm bashbrew tar -cC /usr/local/bin bashbrew | tar -xv
23-
./bashbrew --help > /dev/null
23+
./bashbrew --version
2424
- name: Smoke Test
2525
run: |
2626
image='https://github.com/docker-library/official-images/raw/master/library/hello-world'

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bin/

Dockerfile

+4-3
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@ RUN apt-get update; \
99
rm -rf /var/lib/apt/lists/*
1010

1111
WORKDIR /usr/src/bashbrew
12-
COPY go.mod go.sum ./
12+
COPY go.mod go.sum bashbrew.sh ./
1313
COPY cmd cmd
1414
COPY vendor vendor
1515
RUN export CGO_ENABLED=0; \
16-
go build -mod vendor -v -o /usr/local/bin/bashbrew ./cmd/bashbrew; \
16+
bash -x ./bashbrew.sh --version; \
1717
rm -r ~/.cache/go-build; \
18-
bashbrew --help > /dev/null
18+
mv bin/bashbrew /usr/local/bin/; \
19+
bashbrew --version
1920

2021
ENV BASHBREW_CACHE /bashbrew-cache
2122
# make sure our default cache dir exists and is writable by anyone (similar to /tmp)

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ NAME:
1010
USAGE:
1111
bashbrew [global options] command [command options] [arguments...]
1212

13+
VERSION:
14+
v0.1.0
15+
1316
COMMANDS:
1417
list, ls list repo:tag combinations for a given repo
1518
build build (and tag) repo:tag combinations for a given repo
@@ -35,6 +38,7 @@ GLOBAL OPTIONS:
3538
--library value where the bodies are buried (default: "/home/tianon/docker/official-images/library") [$BASHBREW_LIBRARY]
3639
--cache value where the git wizardry is stashed (default: "/home/tianon/.cache/bashbrew") [$BASHBREW_CACHE]
3740
--help, -h, -? show help
41+
--version, -v print the version
3842
```
3943

4044
## Installing

bashbrew.sh

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
set -Eeuo pipefail
3+
4+
# a small shell script to help compile bashbrew
5+
6+
dir="$(readlink -f "$BASH_SOURCE")"
7+
dir="$(dirname "$dir")"
8+
9+
export GO111MODULE=on
10+
go build -o bin/bashbrew -mod vendor ./cmd/bashbrew > /dev/null
11+
12+
exec "$dir/bin/bashbrew" "$@"

cmd/bashbrew/main.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ func main() {
6666
app := cli.NewApp()
6767
app.Name = "bashbrew"
6868
app.Usage = "canonical build tool for the official images"
69-
app.Version = "dev"
70-
app.HideVersion = true
69+
app.Version = version
7170
app.EnableBashCompletion = true
7271

7372
// TODO add "Description" to app and commands (for longer-form description of their functionality)

cmd/bashbrew/version.go

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package main
2+
3+
const version = "v0.1.0"

0 commit comments

Comments
 (0)