-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
62487f7
commit 43efd95
Showing
4 changed files
with
45 additions
and
61 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
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,58 +1,45 @@ | ||
FROM golang:1.21 AS build-env | ||
FROM golang:1.21 as go-bbn | ||
Check warning on line 1 in contrib/images/babylond/Dockerfile GitHub Actions / docker_pipeline / docker_buildThe 'as' keyword should match the case of the 'from' keyword
|
||
|
||
# Version to build. Default is empty | ||
ARG VERSION | ||
|
||
ARG BUILD_TAGS="" | ||
ARG LEDGER_ENABLED="false" | ||
# Cosmos build options | ||
ARG COSMOS_BUILD_OPTIONS="" | ||
|
||
# Install cli tools for building and final image | ||
RUN apt-get update && apt-get install -y make git bash gcc curl jq | ||
|
||
# Build | ||
WORKDIR /go/src/github.com/babylonlabs-io/babylon | ||
# First cache dependencies | ||
COPY go.mod go.sum /go/src/github.com/babylonlabs-io/babylon/ | ||
RUN go mod download | ||
# Then copy everything else | ||
COPY ./ /go/src/github.com/babylonlabs-io/babylon/ | ||
# If version is set, then checkout this version | ||
|
||
# Handle if version is set | ||
RUN if [ -n "${VERSION}" ]; then \ | ||
git fetch --all; \ | ||
git fetch origin tag ${VERSION} --no-tags; \ | ||
git checkout -f ${VERSION}; \ | ||
fi | ||
|
||
FROM go-bbn as go-bbn-dep | ||
Check warning on line 15 in contrib/images/babylond/Dockerfile GitHub Actions / docker_pipeline / docker_buildThe 'as' keyword should match the case of the 'from' keyword
|
||
|
||
# Cache mod dependencies | ||
RUN go mod download | ||
|
||
FROM go-bbn-dep as build-env | ||
Check warning on line 20 in contrib/images/babylond/Dockerfile GitHub Actions / docker_pipeline / docker_buildThe 'as' keyword should match the case of the 'from' keyword
|
||
|
||
ARG BUILD_TAGS="" | ||
ARG LEDGER_ENABLED="false" | ||
ARG COSMOS_BUILD_OPTIONS="" | ||
|
||
RUN LEDGER_ENABLED=$LEDGER_ENABLED \ | ||
BUILD_TAGS=$BUILD_TAGS \ | ||
COSMOS_BUILD_OPTIONS=$COSMOS_BUILD_OPTIONS \ | ||
LINK_STATICALLY=false \ | ||
make build | ||
|
||
FROM debian:bookworm-slim AS run | ||
# Create a user | ||
RUN addgroup --gid 1137 --system babylon && adduser --uid 1137 --gid 1137 --system --home /home/babylon babylon | ||
RUN apt-get update && apt-get install -y bash curl jq wget | ||
FROM debian:bookworm-slim AS wasm-link | ||
ARG WASMVM_VERSION="v2.0.1" | ||
|
||
RUN apt-get update && apt-get install -y wget bash | ||
|
||
# Label should match your github repo | ||
LABEL org.opencontainers.image.source="https://github.com/babylonlabs-io/babylond:${VERSION}" | ||
Check warning on line 38 in contrib/images/babylond/Dockerfile GitHub Actions / docker_pipeline / docker_buildVariables should be defined before their use
|
||
|
||
# Install libraries | ||
# Cosmwasm - Download correct libwasmvm version | ||
COPY --from=build-env /go/src/github.com/babylonlabs-io/babylon/go.mod /tmp | ||
RUN WASMVM_VERSION=$(grep github.com/CosmWasm/wasmvm /tmp/go.mod | cut -d' ' -f2) && \ | ||
wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/libwasmvm.$(uname -m).so \ | ||
-O /lib/libwasmvm.$(uname -m).so && \ | ||
# verify checksum | ||
wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/checksums.txt -O /tmp/checksums.txt && \ | ||
sha256sum /lib/libwasmvm.$(uname -m).so | grep $(cat /tmp/checksums.txt | grep libwasmvm.$(uname -m) | cut -d ' ' -f 1) | ||
RUN rm -f /tmp/go.mod | ||
RUN wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/libwasmvm.x86_64.so \ | ||
-O /lib/libwasmvm.x86_64.so | ||
|
||
FROM wasm-link as final | ||
Check warning on line 44 in contrib/images/babylond/Dockerfile GitHub Actions / docker_pipeline / docker_buildThe 'as' keyword should match the case of the 'from' keyword
|
||
COPY --from=build-env /go/src/github.com/babylonlabs-io/babylon/build/babylond /bin/babylond | ||
|
||
# Set home directory and user | ||
WORKDIR /home/babylon | ||
RUN chown -R babylon /home/babylon | ||
RUN chmod g+s /home/babylon | ||
USER babylon |
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