-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: dynamic version and refactor builds (#46)
* refactor: dynamic version and refactor builds * fix tests * dockerfile: build-base no longer necessary * chore: add defaults for grpc and ws endpoints
- Loading branch information
1 parent
caec1f8
commit 8c605e6
Showing
8 changed files
with
69 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,5 @@ build | |
mockdata/ | ||
docs | ||
.env | ||
dist | ||
dist | ||
pricefeeder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,49 @@ | ||
version: 2 | ||
project_name: pricefeeder | ||
|
||
env: | ||
- CGO_ENABLED=1 | ||
- CGO_ENABLED=0 | ||
|
||
builds: | ||
- id: darwin | ||
main: . | ||
binary: pricefeeder | ||
hooks: | ||
pre: | ||
- wget https://github.com/CosmWasm/wasmvm/releases/download/v1.3.0/libwasmvmstatic_darwin.a -O /osxcross/target/SDK/MacOSX12.0.sdk/usr/lib/libwasmvmstatic_darwin.a | ||
goos: | ||
- darwin | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
env: | ||
- CC=o64-clang | ||
- CC_darwin_amd64=o64-clang | ||
- CC_darwin_arm64=oa64-clang | ||
- 'CC={{ index .Env (print "CC_" .Os "_" .Arch) }}' | ||
flags: | ||
- -mod=readonly | ||
- -trimpath | ||
ldflags: | ||
- -s -w -X main.commit={{.Commit}} -X main.date={{ .CommitDate }} -X github.com/cosmos/cosmos-sdk/version.Name=nibiru -X github.com/cosmos/cosmos-sdk/version.AppName=nibid -X github.com/cosmos/cosmos-sdk/version.Version={{ .Version }} -X github.com/cosmos/cosmos-sdk/version.Commit={{ .Commit }} | ||
- -linkmode=external | ||
tags: | ||
- netgo | ||
- osusergo | ||
- static_build | ||
- static_wasm | ||
overrides: | ||
- goos: darwin | ||
goarch: arm64 | ||
env: | ||
- CC=oa64-clang | ||
- -s -w | ||
- -X github.com/NibiruChain/pricefeeder/cmd.Version={{ .Version }} | ||
- -X github.com/NibiruChain/pricefeeder/cmd.CommitHash={{ .Commit }} | ||
|
||
- id: linux | ||
main: . | ||
binary: pricefeeder | ||
hooks: | ||
pre: | ||
- wget https://github.com/CosmWasm/wasmvm/releases/download/v1.3.0/libwasmvm_muslc.x86_64.a -O /usr/lib/x86_64-linux-gnu/libwasmvm_muslc.a | ||
- wget https://github.com/CosmWasm/wasmvm/releases/download/v1.3.0/libwasmvm_muslc.aarch64.a -O /usr/lib/aarch64-linux-gnu/libwasmvm_muslc.a | ||
goos: | ||
- linux | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
env: | ||
- CC=x86_64-linux-gnu-gcc | ||
- CC_linux_amd64=x86_64-linux-gnu-gcc | ||
- CC_linux_arm64=aarch64-linux-gnu-gcc | ||
- 'CC={{ index .Env (print "CC_" .Os "_" .Arch) }}' | ||
flags: | ||
- -mod=readonly | ||
- -trimpath | ||
ldflags: | ||
- -s -w -X main.commit={{.Commit}} -X main.date={{ .CommitDate }} -X github.com/cosmos/cosmos-sdk/version.Name=nibiru -X github.com/cosmos/cosmos-sdk/version.AppName=nibid -X github.com/cosmos/cosmos-sdk/version.Version={{ .Version }} -X github.com/cosmos/cosmos-sdk/version.Commit={{ .Commit }} | ||
- -linkmode=external | ||
- -extldflags '-Wl,-z,muldefs -static -lm' | ||
tags: | ||
- netgo | ||
- osusergo | ||
- static_build | ||
- muslc | ||
overrides: | ||
- goos: linux | ||
goarch: arm64 | ||
env: | ||
- CC=aarch64-linux-gnu-gcc | ||
- -s -w | ||
- -X github.com/NibiruChain/pricefeeder/cmd.Version={{ .Version }} | ||
- -X github.com/NibiruChain/pricefeeder/cmd.CommitHash={{ .Commit }} | ||
|
||
universal_binaries: | ||
- id: darwin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,19 @@ | ||
FROM golang:alpine AS builder | ||
|
||
RUN apk add --no-cache git make | ||
|
||
WORKDIR /feeder | ||
|
||
COPY go.sum go.mod ./ | ||
RUN go mod download | ||
COPY . . | ||
RUN --mount=type=cache,target=/root/.cache/go-build \ | ||
--mount=type=cache,target=/go/pkg \ | ||
go build -o ./build/feeder . | ||
make build | ||
|
||
FROM gcr.io/distroless/static:nonroot | ||
|
||
WORKDIR / | ||
COPY --from=builder /feeder/build/feeder . | ||
COPY --from=builder /feeder/pricefeeder . | ||
USER nonroot:nonroot | ||
ENTRYPOINT ["/feeder"] | ||
ENTRYPOINT ["/pricefeeder"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters