-
Notifications
You must be signed in to change notification settings - Fork 40
/
Dockerfile
48 lines (39 loc) · 1.32 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
# syntax=docker/dockerfile:1.3-labs
###########################
#### Base image ####
###########################
FROM golang:1.22-bullseye AS base
WORKDIR /app
###########################
#### Local development ####
###########################
FROM base AS local-dev
RUN cd /tmp && go install github.com/cespare/reflex@latest
COPY <<EOF /hack-start-because-cosmos-always-wants-to-read-pass-from-stdin.sh
#!/usr/bin/env bash
go run ./cmd/pigeon -c config.local-dev.yaml start < /dev/null
EOF
RUN chmod +x /hack-start-because-cosmos-always-wants-to-read-pass-from-stdin.sh
CMD ["/app/scripts/live-reload.sh", "/hack-start-because-cosmos-always-wants-to-read-pass-from-stdin.sh"]
###########################
#### 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 /sparrow ./cmd/sparrow
###########################
#### Local testnet ####
###########################
FROM ubuntu AS local-testnet
ENTRYPOINT ["/sparrow"]
COPY --from=builder /sparrow /sparrow
###########################
#### Release ####
###########################
FROM base AS release
RUN go install github.com/goreleaser/goreleaser@latest
COPY . /app
CMD ["goreleaser", "release", "--rm-dist"]