Skip to content

Commit

Permalink
fix: move gnofaucet to contribs (#1955)
Browse files Browse the repository at this point in the history
## Description

This PR moves the `gnofaucet` codebase from `gno.land/cmd/gnofaucet` to
`./contribs/gnofaucet`, as this is causing API shenanigans when any
`gno` API used by the `gnolang/faucet` library is changed.

Thank you @gfanton for resolving the Docker funny business 🙏 

<details><summary>Contributors' checklist...</summary>

- [x] Added new tests, or not needed, or not feasible
- [x] Provided an example (e.g. screenshot) to aid review or the PR is
self-explanatory
- [x] Updated the official documentation or not needed
- [x] No breaking changes were made, or a `BREAKING CHANGE: xxx` message
was included in the description
- [ ] Added references to related issues and PRs
- [ ] Provided any useful hints for running manual tests
- [ ] Added new benchmarks to [generated
graphs](https://gnoland.github.io/benchmarks), if any. More info
[here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md).
</details>

---------

Signed-off-by: gfanton <[email protected]>
Co-authored-by: gfanton <[email protected]>
  • Loading branch information
zivkovicmilos and gfanton authored Apr 19, 2024
1 parent 67c437f commit 5a976ef
Show file tree
Hide file tree
Showing 18 changed files with 306 additions and 29 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/contribs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ jobs:
strategy:
fail-fast: false
matrix:
goversion: # two latest versions
goversion:
- "1.22.x"
program:
- "gnomd"
- "gnodev"
- "gnofaucet"
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/gnoland.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ jobs:
- gnoland
- gnokey
- gnoweb
- gnofaucet
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
Expand Down
36 changes: 23 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
# build
FROM golang:1.22 AS build
# build gno
FROM golang:1.22 AS build-gno
RUN mkdir -p /opt/gno/src /opt/build
WORKDIR /opt/build
ADD go.mod go.sum ./
ADD go.mod go.sum .
RUN go mod download
ADD . ./
RUN go build -o ./build/gnoland ./gno.land/cmd/gnoland
RUN go build -o ./build/gnokey ./gno.land/cmd/gnokey
RUN go build -o ./build/gnofaucet ./gno.land/cmd/gnofaucet
RUN go build -o ./build/gnoweb ./gno.land/cmd/gnoweb
RUN go build -o ./build/gno ./gnovm/cmd/gno
RUN ls -la ./build
ADD . /opt/gno/src/
RUN rm -rf /opt/gno/src/.git

# build faucet
FROM golang:1.22 AS build-faucet
RUN mkdir -p /opt/gno/src /opt/build
WORKDIR /opt/build
ADD contribs/gnofaucet/go.mod contribs/gnofaucet/go.sum .
RUN go mod download
ADD contribs/gnofaucet ./
RUN go build -o ./build/gnofaucet .


# runtime-base + runtime-tls
FROM debian:stable-slim AS runtime-base
ENV PATH="${PATH}:/opt/gno/bin" \
Expand All @@ -25,32 +34,33 @@ RUN apt-get update && apt-get install -y expect ca-certificates && updat
# slim images
FROM runtime-base AS gnoland-slim
WORKDIR /opt/gno/src/gno.land/
COPY --from=build /opt/build/build/gnoland /opt/gno/bin/
COPY --from=build-gno /opt/build/build/gnoland /opt/gno/bin/
ENTRYPOINT ["gnoland"]
EXPOSE 26657 36657

FROM runtime-base AS gnokey-slim
COPY --from=build /opt/build/build/gnokey /opt/gno/bin/
COPY --from=build-gno /opt/build/build/gnokey /opt/gno/bin/
ENTRYPOINT ["gnokey"]

FROM runtime-base AS gno-slim
COPY --from=build /opt/build/build/gno /opt/gno/bin/
COPY --from=build-gno /opt/build/build/gno /opt/gno/bin/
ENTRYPOINT ["gno"]

FROM runtime-tls AS gnofaucet-slim
COPY --from=build /opt/build/build/gnofaucet /opt/gno/bin/
COPY --from=build-faucet /opt/build/build/gnofaucet /opt/gno/bin/
ENTRYPOINT ["gnofaucet"]
EXPOSE 5050

FROM runtime-tls AS gnoweb-slim
COPY --from=build /opt/build/build/gnoweb /opt/gno/bin/
COPY --from=build /opt/gno/src/gno.land/cmd/gnoweb /opt/gno/src/gnoweb
COPY --from=build-gno /opt/build/build/gnoweb /opt/gno/bin/
COPY --from=build-gno /opt/gno/src/gno.land/cmd/gnoweb /opt/gno/src/gnoweb
ENTRYPOINT ["gnoweb"]
EXPOSE 8888

# all, contains everything.
FROM runtime-tls AS all
COPY --from=build /opt/build/build/* /opt/gno/bin/
COPY --from=build /opt/gno/src /opt/gno/src
COPY --from=build-gno /opt/build/build/* /opt/gno/bin/
COPY --from=build-faucet /opt/build/build/* /opt/gno/bin/
COPY --from=build-gno /opt/gno/src /opt/gno/src
# gofmt is required by `gnokey maketx addpkg`
COPY --from=build /usr/local/go/bin/gofmt /usr/bin
COPY --from=build-gno /usr/local/go/bin/gofmt /usr/bin
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ repository offers more resources to dig into. We are eager to see your first PR!
* [gno](./gnovm/cmd/gno) - handy tool for developing gno packages & realms
* [goscan](./misc/goscan) - dumps imports from specified file’s AST
* [genproto](./misc/genproto) - helper for generating .proto implementations
* [gnofaucet](./gno.land/cmd/gnofaucet) - serves GNOT faucet
* [gnofaucet](./contribs/gnofaucet) - serves GNOT faucet
</details>

<details><summary>CI/CD/Tools badges and links</summary>
Expand Down
3 changes: 2 additions & 1 deletion contribs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ GOTEST_FLAGS ?= -v -p 1 -timeout=30m
########################################
# Dev tools
.PHONY: install
install: install.gnomd install.gnodev
install: install.gnomd install.gnodev install.gnofaucet

install.gnomd:; cd gnomd && go install .
install.gnodev:; $(MAKE) -C ./gnodev install
install.gnofaucet:; $(MAKE) -C ./gnofaucet install

.PHONY: clean
clean:
Expand Down
7 changes: 7 additions & 0 deletions contribs/gnofaucet/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.PHONY: install
install:
go install .

.PHONY: build
build:
go build -o build/gnofaucet .
52 changes: 52 additions & 0 deletions contribs/gnofaucet/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
module github.com/gnolang/gno/contribs/gnofaucet

go 1.21

require (
github.com/gnolang/faucet v0.2.0
github.com/gnolang/gno v0.0.0-20240418134550-6f54d2b3d06c
github.com/stretchr/testify v1.9.0
go.uber.org/zap v1.27.0
golang.org/x/time v0.5.0
)

require (
github.com/btcsuite/btcd/btcec/v2 v2.3.3 // indirect
github.com/btcsuite/btcd/btcutil v1.1.5 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect
github.com/gnolang/overflow v0.0.0-20170615021017-4d914c927216 // indirect
github.com/go-chi/chi/v5 v5.0.12 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/gorilla/websocket v1.5.1 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 // indirect
github.com/jaekwon/testify v1.6.1 // indirect
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
github.com/peterbourgon/ff/v3 v3.4.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rs/cors v1.10.1 // indirect
go.opentelemetry.io/otel v1.25.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.25.0 // indirect
go.opentelemetry.io/otel/metric v1.25.0 // indirect
go.opentelemetry.io/otel/sdk v1.25.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.25.0 // indirect
go.opentelemetry.io/otel/trace v1.25.0 // indirect
go.opentelemetry.io/proto/otlp v1.1.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap/exp v0.2.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect
golang.org/x/mod v0.16.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/term v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda // indirect
google.golang.org/grpc v1.63.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit 5a976ef

Please sign in to comment.