Skip to content

Commit

Permalink
feat: add build gnofaucet layer
Browse files Browse the repository at this point in the history
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
  • Loading branch information
gfanton committed Apr 18, 2024
1 parent 626262c commit 5e267d4
Showing 1 changed file with 24 additions and 13 deletions.
37 changes: 24 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
# 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
# special case for gnofaucet
RUN go -modfile=contribs/gnofaucet/go.mod build -o ./build/gnofaucet ./contribs/gnofaucet/go.mod
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 +36,32 @@ 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-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

0 comments on commit 5e267d4

Please sign in to comment.