Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: docker build & release #1645

Merged
merged 33 commits into from
Dec 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
36e2abd
feat: don't release docker on RC releases
robert-zaremba Dec 5, 2022
9a9a6fb
fix docker package
robert-zaremba Dec 5, 2022
f69d53e
check build
robert-zaremba Dec 5, 2022
f99b8d6
use docker driver
robert-zaremba Dec 5, 2022
a4681f2
fix yaml syntax
robert-zaremba Dec 5, 2022
dabe6ac
run on every push
robert-zaremba Dec 5, 2022
4cf0379
fix job name
robert-zaremba Dec 5, 2022
f201aef
list directories
robert-zaremba Dec 5, 2022
9abe493
change context
robert-zaremba Dec 5, 2022
0424275
add metadata tags
robert-zaremba Dec 5, 2022
d1c8a36
update dockerfile
robert-zaremba Dec 5, 2022
b9b6f98
update workflow
robert-zaremba Dec 5, 2022
3adf8ec
add buildx
robert-zaremba Dec 5, 2022
666fdc8
don't download libwasmvs
robert-zaremba Dec 5, 2022
2df62b1
don't link statically
robert-zaremba Dec 5, 2022
a47ff0b
add concurrency check
robert-zaremba Dec 5, 2022
dcade29
use debian for docker publish
robert-zaremba Dec 5, 2022
49125a1
move umee.e2e.dockerfile
robert-zaremba Dec 5, 2022
3160e0f
rename price-feeder
robert-zaremba Dec 5, 2022
f26408b
don't upgrade
robert-zaremba Dec 5, 2022
2d977f9
update plaforms
robert-zaremba Dec 5, 2022
e1636a2
use load
robert-zaremba Dec 5, 2022
2af340d
update action
robert-zaremba Dec 5, 2022
21bda1c
update image name
robert-zaremba Dec 5, 2022
8559340
enable labels
robert-zaremba Dec 5, 2022
9ddaccf
update image name
robert-zaremba Dec 5, 2022
258ce93
use github.repository env
robert-zaremba Dec 5, 2022
ac9cf1d
simplify
robert-zaremba Dec 5, 2022
f47040c
use umeed for package name
robert-zaremba Dec 5, 2022
8980765
release docker on full release
robert-zaremba Dec 5, 2022
a55ffb4
Merge branch 'main' into robert/fix-docker-build
robert-zaremba Dec 5, 2022
36c6730
Merge branch 'main' into robert/fix-docker-build
robert-zaremba Dec 6, 2022
12d3519
Merge branch 'main' into robert/fix-docker-build
robert-zaremba Dec 7, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions .github/workflows/price-feeder-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@ jobs:

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: umee-network/price-feeder
tags:
type=semver,pattern=v{{version}}

tags: type=semver,pattern=v{{version}}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

Expand All @@ -38,7 +37,7 @@ jobs:
- name: Build and push
uses: docker/build-push-action@v3
with:
context: ./contrib/images/price-feeder.Dockerfile
context: ./contrib/images/price-feeder.dockerfile
robert-zaremba marked this conversation as resolved.
Show resolved Hide resolved
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
39 changes: 27 additions & 12 deletions .github/workflows/umee-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
name: Umeed Docker Release
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- "v[0-9]+\\.[0-9]+\\.[0-9]+" # Official release version tags e.g. v2.0.5
- "v[0-9]+\\.[0-9]+\\.[0-9]+-rc[0-9]+" # Release candidate tags e.g. v1.0.3-rc4
- "v[0-9]+\\.[0-9]+\\.[0-9]+" # Push only official release version tags e.g. v2.0.5

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
umeed-docker:
Expand All @@ -16,18 +18,28 @@ jobs:
- name: checkout
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Docker meta
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: umee-network/umeed

# github.repository == <account>/<repo>
images: ghcr.io/${{ github.repository_owner }}/umeed
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=semver,pattern={{version}}
type=semver,pattern=latest-{{major}}.{{minor}}
flavor: |
latest=false
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Print tags and labels
run: |
echo image: ${{ env.REGISTRY }}/${{ github.repository }}
echo tags "${{ steps.meta.outputs.tags }}"
echo labels "${{ steps.meta.outputs.labels }}"
- name: Login to GHCR
uses: docker/login-action@v2
with:
Expand All @@ -38,8 +50,11 @@ jobs:
- name: Build and push
uses: docker/build-push-action@v3
with:
context: ./contrib/images/umeed.Dockerfile
push: true
file: contrib/images/umeed.dockerfile
platforms: linux/amd64
# platforms: linux/amd64,linux/arm64 # requires qemu action
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

cache-from: type=gha
cache-to: type=gha,mode=max
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ build: go.sum
build-experimental: go.sum
@echo "--> Building Experimental version..."
EXPERIMENTAL=true $(MAKE) build

build-no_cgo:
@echo "--> Building static binary with no CGO nor GLIBC dynamic linking..."
CGO_ENABLED=0 CGO_LDFLAGS="-static" $(MAKE) build
Expand Down Expand Up @@ -121,7 +121,7 @@ clean:
###############################################################################

docker-build:
@docker build -t umeenet/umeed-e2e -f umee.e2e.Dockerfile .
@docker build -t umeenet/umeed-e2e -f contrib/images/umee.e2e.dockerfile .

docker-push-hermes:
@cd tests/e2e/docker; docker build -t ghcr.io/umee-network/hermes-e2e:latest -f hermes.Dockerfile .; docker push ghcr.io/umee-network/hermes-e2e:latest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Fetch base packages
FROM golang:1.19-alpine AS builder
ENV PACKAGES make git libc-dev gcc linux-headers build-base
RUN apk add --no-cache $PACKAGES
WORKDIR /src/app/
RUN apk add --no-cache make git libc-dev gcc linux-headers build-base
WORKDIR /src/
COPY . .

# Cosmwasm - Download correct libwasmvm version
RUN WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm | cut -d ' ' -f 2) && \
wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/libwasmvm_muslc.$(uname -m).a \
Expand All @@ -14,8 +14,7 @@ RUN WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm | cut -d ' ' -f 2) &&
# Build the binary
RUN cd price-feeder && LEDGER_ENABLED=false BUILD_TAGS=muslc LINK_STATICALLY=true make install


FROM alpine:3.14
FROM alpine:3.17
RUN apk add bash curl jq
COPY --from=builder /go/bin/price-feeder /usr/local/bin/
EXPOSE 7171
Expand Down
14 changes: 6 additions & 8 deletions umee.e2e.Dockerfile → contrib/images/umee.e2e.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ RUN apk add --no-cache $PACKAGES

# Compile the umeed binary
FROM umee-base-builder AS umeed-builder
WORKDIR /src/app/
COPY go.mod go.sum* ./
WORKDIR /src/umee
COPY . .
RUN go mod download

# Cosmwasm - Download correct libwasmvm version
RUN WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm | cut -d ' ' -f 2) && \
wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/libwasmvm_muslc.$(uname -m).a \
Expand All @@ -21,23 +22,20 @@ RUN WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm | cut -d ' ' -f 2) &&
wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/checksums.txt -O /tmp/checksums.txt && \
sha256sum /lib/libwasmvm_muslc.a | grep $(cat /tmp/checksums.txt | grep $(uname -m) | cut -d ' ' -f 1)

# Copy the remaining files
COPY . .
RUN LEDGER_ENABLED=false BUILD_TAGS=muslc LINK_STATICALLY=true make install
RUN cd price-feeder && LEDGER_ENABLED=false BUILD_TAGS=muslc LINK_STATICALLY=true make install

# # Fetch peggo (gravity bridge) binary
FROM base-builder AS peggo-builder
ARG PEGGO_VERSION=v0.3.0
WORKDIR /downloads/
WORKDIR /src/peggo
RUN git clone https://github.com/umee-network/peggo.git
RUN cd peggo && git checkout ${PEGGO_VERSION} && make build && cp ./build/peggo /usr/local/bin/

# Add to a distroless container
FROM gcr.io/distroless/cc:debug
COPY --from=umeed-builder /go/bin/umeed /usr/local/bin/
COPY --from=umeed-builder /go/bin/price-feeder /usr/local/bin/
COPY --from=umeed-builder /go/bin/* /usr/local/bin/
COPY --from=peggo-builder /usr/local/bin/peggo /usr/local/bin/
EXPOSE 26656 26657 1317 9090 7171

EXPOSE 26656 26657 1317 9090 7171
ENTRYPOINT ["umeed", "start"]
23 changes: 0 additions & 23 deletions contrib/images/umeed.Dockerfile

This file was deleted.

23 changes: 23 additions & 0 deletions contrib/images/umeed.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Stage-1: build
# We use Debian Bullseye rather then Alpine because Alpine has problem building libwasmvm
# - requires to download libwasmvm_muslc from external source. Build with glibc is straightforward.
FROM golang:1.19-bullseye AS builder

WORKDIR /src/
COPY . .

RUN LEDGER_ENABLED=false BUILD_TAGS=badgerdb make install

# Stage-2: copy binary and required artifacts to a fresh image
# we need to use debian compatible system.
FROM ubuntu:rolling
# RUN apt update && apt upgrade -y ca-certificates

COPY --from=builder /go/bin/umeed /usr/local/bin/
COPY --from=builder /go/pkg/mod/github.com/\!cosm\!wasm/wasmvm\@v*/internal/api/libwasmvm.*.so /usr/lib/

EXPOSE 26656 26657 1317 9090

# Run umeed by default, omit entrypoint to ease using container with CLI
CMD ["umeed"]
STOPSIGNAL SIGTERM