forked from gnolang/gno
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
176 lines (160 loc) · 8.39 KB
/
Dockerfile
File metadata and controls
176 lines (160 loc) · 8.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# setup gnocore basics
FROM golang:1.24-alpine AS setup-gnocore
ENV GNOROOT="/gnoroot"
ENV CGO_ENABLED=0 GOOS=linux
WORKDIR /gnoroot
RUN go env -w GOMODCACHE=/root/.cache/go-build
# Mod files
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/go/pkg/mod/,id=gomodcache \
--mount=type=cache,target=/root/.cache/go-build,id=gobuildcache \
go mod download -x
COPY . ./
# build gnocore
FROM setup-gnocore AS build-gnocore
# Gnoland
RUN --mount=type=cache,target=/go/pkg/mod/,id=gomodcache \
--mount=type=cache,target=/root/.cache/go-build,id=gobuildcache \
go build -ldflags "-w -s" -o ./build/gnoland ./gno.land/cmd/gnoland
# Gnokey
RUN --mount=type=cache,target=/go/pkg/mod/,id=gomodcache \
--mount=type=cache,target=/root/.cache/go-build,id=gobuildcache \
go build -ldflags "-w -s" -o ./build/gnokey ./gno.land/cmd/gnokey
# Gnoweb
RUN --mount=type=cache,target=/go/pkg/mod/,id=gomodcache \
--mount=type=cache,target=/root/.cache/go-build,id=gobuildcache \
go build -ldflags "-w -s" -o ./build/gnoweb ./gno.land/cmd/gnoweb
# Gno
RUN --mount=type=cache,target=/go/pkg/mod/,id=gomodcache \
--mount=type=cache,target=/root/.cache/go-build,id=gobuildcache \
go build -ldflags "-w -s" -o ./build/gno ./gnovm/cmd/gno
# Gnofaucet build
FROM setup-gnocore AS build-gnofaucet
WORKDIR /gnoroot/contribs/gnofaucet
RUN --mount=type=cache,target=/go/pkg/mod/,id=faucet-modcache \
--mount=type=cache,target=/root/.cache/go-build,id=faucet-buildcache \
go mod download -x
RUN --mount=type=cache,target=/go/pkg/mod/,id=faucet \
--mount=type=cache,target=/root/.cache/go-build,id=faucet-buildcache \
go build -ldflags "-w -s" -o /gnoroot/build/gnofaucet .
# Gnodev build
FROM setup-gnocore AS build-gnodev
WORKDIR /gnoroot/contribs/gnodev
RUN --mount=type=cache,target=/go/pkg/mod/,id=gnodev-modcache \
--mount=type=cache,target=/root/.cache/go-build,id=gnodev-buildcache \
go mod download -x
RUN --mount=type=cache,target=/go/pkg/mod/,id=gnodev-modcache \
--mount=type=cache,target=/root/.cache/go-build,id=gnodev-buildcache \
go build \
-ldflags "-X github.com/gnolang/gno/gnovm/pkg/gnoenv._GNOROOT=/gnoroot" \
-o /gnoroot/build/gnodev .
# Gnobro build
FROM setup-gnocore AS build-gnobro
WORKDIR /gnoroot/contribs/gnobro
RUN --mount=type=cache,target=/go/pkg/mod/,id=gnobro-modcache \
--mount=type=cache,target=/root/.cache/go-build,id=gnobro-buildcache \
go build \
-ldflags "-X github.com/gnolang/gno/gnovm/pkg/gnoenv._GNOROOT=/gnoroot" \
-o /gnoroot/build/gnobro .
# Gnocontribs
## Gnogenesis
FROM setup-gnocore AS build-contribs
WORKDIR /gnoroot/contribs/gnogenesis
RUN --mount=type=cache,target=/go/pkg/mod/,id=contribs_modcache \
--mount=type=cache,target=/root/.cache/go-build,id=contribs_buildcache \
go mod download -x
RUN --mount=type=cache,target=/go/pkg/mod/,id=contribs_modcache \
--mount=type=cache,target=/root/.cache/go-build,id=contribs_buildcache \
go build -ldflags "-w -s" -o /gnoroot/build/gnogenesis .
# Misc build
FROM setup-gnocore AS build-misc
## Staging
WORKDIR /gnoroot/misc/loop
RUN --mount=type=cache,target=/go/pkg/mod/,id=pl-modcache \
--mount=type=cache,target=/root/.cache/go-build,id=pl-buildcache \
go mod download -x
RUN --mount=type=cache,target=/go/pkg/mod/,id=pl-modcache \
--mount=type=cache,target=/root/.cache/go-build,id=pl-buildcache \
go build -ldflags "-w -s" -o /gnoroot/build/portalloopd ./cmd
# Base image
FROM alpine:3 AS base
WORKDIR /gnoroot
ENV GNOROOT="/gnoroot"
RUN apk add --no-cache ca-certificates
# Gnoland image
## ghcr.io/gnolang/gno/gnoland
FROM base AS gnoland
COPY --from=build-gnocore /gnoroot/build/gnoland /usr/bin/gnoland
COPY --from=build-gnocore /gnoroot/examples /gnoroot/examples
COPY --from=build-gnocore /gnoroot/gnovm/stdlibs /gnoroot/gnovm/stdlibs
COPY --from=build-gnocore /gnoroot/gnovm/tests/stdlibs /gnoroot/gnovm/tests/stdlibs
COPY --from=build-gnocore /gnoroot/gno.land/genesis/genesis_txs.jsonl /gnoroot/gno.land/genesis/genesis_txs.jsonl
COPY --from=build-gnocore /gnoroot/gno.land/genesis/genesis_balances.txt /gnoroot/gno.land/genesis/genesis_balances.txt
EXPOSE 26656 26657
ENTRYPOINT ["/usr/bin/gnoland"]
# Gnokey image
## ghcr.io/gnolang/gno/gnokey
FROM base AS gnokey
COPY --from=build-gnocore /gnoroot/build/gnokey /usr/bin/gnokey
# gofmt is required by `gnokey maketx addpkg`
COPY --from=build-gnocore /usr/local/go/bin/gofmt /usr/bin/gofmt
ENTRYPOINT ["/usr/bin/gnokey"]
# Gnoweb image
## ghcr.io/gnolang/gno/gnoweb
FROM base AS gnoweb
COPY --from=build-gnocore /gnoroot/build/gnoweb /usr/bin/gnoweb
EXPOSE 8888
ENTRYPOINT ["/usr/bin/gnoweb"]
# Gnofaucet image
## ghcr.io/gnolang/gno/gnofaucet
FROM base AS gnofaucet
COPY --from=build-gnofaucet /gnoroot/build/gnofaucet /usr/bin/gnofaucet
EXPOSE 5050
ENTRYPOINT ["/usr/bin/gnofaucet"]
# Gnodev image
## ghcr.io/gnolang/gno/gnodev
FROM base AS gnodev
COPY --from=build-gnodev /gnoroot/build/gnodev /usr/bin/gnodev
COPY --from=build-gnocore /gnoroot/examples /gnoroot/examples
COPY --from=build-gnocore /gnoroot/gnovm/stdlibs /gnoroot/gnovm/stdlibs
COPY --from=build-gnocore /gnoroot/gnovm/tests/stdlibs /gnoroot/gnovm/tests/stdlibs
COPY --from=build-gnocore /gnoroot/gno.land/genesis/genesis_txs.jsonl /gnoroot/gno.land/genesis/genesis_txs.jsonl
COPY --from=build-gnocore /gnoroot/gno.land/genesis/genesis_balances.txt /gnoroot/gno.land/genesis/genesis_balances.txt
# gnoweb port exposed by default
EXPOSE 8888
ENTRYPOINT ["/usr/bin/gnodev"]
# Gno
FROM base AS gno
COPY --from=build-gnocore /gnoroot/build/gno /usr/bin/gno
COPY --from=build-gnocore /gnoroot/examples /gnoroot/examples
COPY --from=build-gnocore /gnoroot/gnovm/stdlibs /gnoroot/gnovm/stdlibs
COPY --from=build-gnocore /gnoroot/gnovm/tests/stdlibs /gnoroot/gnovm/tests/stdlibs
ENTRYPOINT ["/usr/bin/gno"]
# Gno Contribs [ Gnobro, Gnogenesis ]
## ghcr.io/gnolang/gnocontribs
FROM base AS gnocontribs
COPY --from=build-gnobro /gnoroot/build/gnobro /usr/bin/gnobro
COPY --from=build-contribs /gnoroot/build/gnogenesis /usr/bin/gnogenesis
COPY --from=build-gnocore /gnoroot/examples /gnoroot/examples
COPY --from=build-gnocore /gnoroot/gno.land/genesis/genesis_txs.jsonl /gnoroot/gno.land/genesis/genesis_txs.jsonl
COPY --from=build-gnocore /gnoroot/gno.land/genesis/genesis_balances.txt /gnoroot/gno.land/genesis/genesis_balances.txt
EXPOSE 22
ENTRYPOINT [ "/bin/sh", "-c" ]
# misc/loop
FROM docker AS portalloopd
WORKDIR /gnoroot
ENV GNOROOT="/gnoroot"
RUN apk add --no-cache ca-certificates bash curl jq
COPY --from=build-misc /gnoroot/build/portalloopd /usr/bin/portalloopd
ENTRYPOINT ["/usr/bin/portalloopd"]
CMD ["serve"]
# all, contains everything.
FROM base AS all
COPY --from=build-gnocore /gnoroot/build/* /usr/bin/
COPY --from=build-gnocore /gnoroot/examples /gnoroot/examples
COPY --from=build-gnocore /gnoroot/gnovm/stdlibs /gnoroot/gnovm/stdlibs
COPY --from=build-gnocore /gnoroot/gnovm/tests/stdlibs /gnoroot/gnovm/tests/stdlibs
COPY --from=build-gnocore /gnoroot/gno.land/genesis/genesis_txs.jsonl /gnoroot/gno.land/genesis/genesis_txs.jsonl
COPY --from=build-gnocore /gnoroot/gno.land/genesis/genesis_balances.txt /gnoroot/gno.land/genesis/genesis_balances.txt
# gofmt is required by `gnokey maketx addpkg`
COPY --from=build-gnocore /usr/local/go/bin/gofmt /usr/bin