Skip to content

Commit a9f9600

Browse files
Add command to generate schemas to uuid-annotator Docker image (#59)
* Add command to generate uuid-annotator schemas * Build generate-schemas command * Add hint about generate-schemas to README.md
1 parent 7509693 commit a9f9600

File tree

5 files changed

+328
-2
lines changed

5 files changed

+328
-2
lines changed

Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ RUN go get -v . && \
66
CGO_ENABLED=0 go install -v \
77
-ldflags "-X github.com/m-lab/go/prometheusx.GitShortCommit=$(git log -1 --format=%h)" \
88
.
9+
RUN cd ./cmd/generate-schemas && CGO_ENABLED=0 go install -v .
910

1011
# Put it in its own image.
11-
FROM alpine
12+
FROM alpine:3.18
1213
COPY --from=build /go/bin/uuid-annotator /uuid-annotator
14+
COPY --from=build /go/bin/generate-schemas /generate-schemas
1315
COPY ./data/asnames.ipinfo.csv /data/asnames.ipinfo.csv
1416
# In the fullness of time, we would like to replace this local file with a
1517
# download from a GCS url that we control and is passed in as a command-line
@@ -18,6 +20,7 @@ COPY ./data/asnames.ipinfo.csv /data/asnames.ipinfo.csv
1820
# worth it, we ship the 3.7MB data file with the binary.
1921
ENV ASNAME_URL file:///data/asnames.ipinfo.csv
2022
WORKDIR /
21-
# Make sure /uuid-annotator can run (has no missing external dependencies).
23+
# Make sure binaries can run (has no missing external dependencies).
2224
RUN /uuid-annotator -h 2> /dev/null
25+
RUN /generate-schemas -h 2> /dev/null
2326
ENTRYPOINT ["/uuid-annotator"]

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,13 @@ docker run -v $PWD/testdata:/testdata -it local-annotator \
6969
-routeview-v4.url=file:///testdata/RouteViewIPv4.pfx2as.gz \
7070
-routeview-v6.url=file:///testdata/RouteViewIPv6.pfx2as.gz
7171
```
72+
73+
### Generate Schemas
74+
75+
If using uuid-annotator data as part of the autoloader pipeline, you may
76+
generate the data type schemas using the `generate-schemas` command:
77+
78+
```sh
79+
docker run -v $PWD:/schemas --entrypoint /generate-schemas -it local-annotator \
80+
-ann2 /schemas/ann2.json -hop2 /schemas/hop2.json
81+
```

cmd/generate-schemas/go.mod

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
module github.com/m-lab/uuid-annotator/cmd/generate-schemas
2+
3+
go 1.20
4+
5+
require (
6+
cloud.google.com/go/bigquery v1.57.1
7+
github.com/m-lab/go v0.1.66
8+
github.com/m-lab/uuid-annotator v0.5.3
9+
)
10+
11+
require (
12+
cloud.google.com/go v0.110.8 // indirect
13+
cloud.google.com/go/compute v1.23.1 // indirect
14+
cloud.google.com/go/compute/metadata v0.2.3 // indirect
15+
cloud.google.com/go/iam v1.1.3 // indirect
16+
github.com/andybalholm/brotli v1.0.4 // indirect
17+
github.com/apache/arrow/go/v12 v12.0.0 // indirect
18+
github.com/apache/thrift v0.16.0 // indirect
19+
github.com/goccy/go-json v0.9.11 // indirect
20+
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
21+
github.com/golang/protobuf v1.5.3 // indirect
22+
github.com/golang/snappy v0.0.4 // indirect
23+
github.com/google/flatbuffers v2.0.8+incompatible // indirect
24+
github.com/google/s2a-go v0.1.7 // indirect
25+
github.com/google/uuid v1.4.0 // indirect
26+
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
27+
github.com/googleapis/gax-go/v2 v2.12.0 // indirect
28+
github.com/klauspost/asmfmt v1.3.2 // indirect
29+
github.com/klauspost/compress v1.15.9 // indirect
30+
github.com/klauspost/cpuid/v2 v2.0.9 // indirect
31+
github.com/m-lab/tcp-info v1.5.3 // indirect
32+
github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8 // indirect
33+
github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3 // indirect
34+
github.com/pierrec/lz4/v4 v4.1.15 // indirect
35+
github.com/zeebo/xxh3 v1.0.2 // indirect
36+
go.opencensus.io v0.24.0 // indirect
37+
golang.org/x/crypto v0.14.0 // indirect
38+
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 // indirect
39+
golang.org/x/mod v0.10.0 // indirect
40+
golang.org/x/net v0.17.0 // indirect
41+
golang.org/x/oauth2 v0.13.0 // indirect
42+
golang.org/x/sync v0.4.0 // indirect
43+
golang.org/x/sys v0.13.0 // indirect
44+
golang.org/x/text v0.13.0 // indirect
45+
golang.org/x/tools v0.9.1 // indirect
46+
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
47+
google.golang.org/api v0.149.0 // indirect
48+
google.golang.org/appengine v1.6.7 // indirect
49+
google.golang.org/genproto v0.0.0-20231016165738-49dd2c1f3d0b // indirect
50+
google.golang.org/genproto/googleapis/api v0.0.0-20231016165738-49dd2c1f3d0b // indirect
51+
google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b // indirect
52+
google.golang.org/grpc v1.59.0 // indirect
53+
google.golang.org/protobuf v1.31.0 // indirect
54+
gopkg.in/yaml.v2 v2.4.0 // indirect
55+
)

0 commit comments

Comments
 (0)