forked from palomachain/paloma
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
57 lines (47 loc) · 1.58 KB
/
Dockerfile
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
###########################
#### Base image ####
###########################
FROM golang:1.22-buster AS base
# TODO add non-root user
LABEL org.opencontainers.image.authors="[email protected]"
WORKDIR /app
###########################
#### Builder ####
###########################
FROM base AS builder
COPY . /app
RUN \
--mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
cd /app && go build -o /palomad ./cmd/palomad
#################################
#### Local chain setup ####
#################################
FROM ubuntu AS setup-chain-locally
RUN apt-get update && \
apt-get install -y jq
OPY --from=builder /palomad /palomad
COPY --from=builder /app/scripts/setup-chain-validator.sh /app/scripts/setup-chain-validator.sh
RUN PALOMA_CMD="/palomad" /app/scripts/setup-chain-validator.sh
###########################
#### Local development ####
###########################
FROM base AS local-dev
RUN cd /tmp && go install github.com/cosmtrek/air@latest
COPY --from=setup-chain-locally /root/.paloma /root/.paloma
# air is not set to entrypoint because I want to override that behaviour
# when using docker-compose run.
CMD ["air"]
###########################
#### Local testnet ####
###########################
FROM ubuntu AS local-testnet
ENTRYPOINT ["/palomad"]
COPY --from=builder /palomad /palomad
###########################
#### Release ####
###########################
FROM base AS release
RUN go install github.com/goreleaser/goreleaser@latest
COPY . /app
CMD ["goreleaser", "release", "--rm-dist"]