forked from palomachain/paloma
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
58 lines (47 loc) · 1.56 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
58
###########################
#### Base image ####
###########################
FROM golang:1.18-stretch AS base
# TODO add non-root user
MAINTAINER Matija Martinic <matija@volume.finance>
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
COPY --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"]