Skip to content

Commit

Permalink
Feat/docker entrypoint (#61)
Browse files Browse the repository at this point in the history
* updates to dockerfile

updates to dockerfile

updates to dockerfile

* remove branch from workflow
  • Loading branch information
Greg Junge authored Nov 15, 2022
1 parent 7ce7c85 commit 4cb4efe
Showing 1 changed file with 33 additions and 18 deletions.
51 changes: 33 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,51 @@
# docker run --rm -it cosmwasm/wasmd:latest /bin/sh
FROM golang:1.18-alpine3.14 AS go-builder

# this comes from standard alpine nightly file
# https://github.com/rust-lang/docker-rust-nightly/blob/master/alpine3.12/Dockerfile
# with some changes to support our toolchain, etc
RUN set -eux; apk add --no-cache ca-certificates build-base;

RUN apk add git build-base cmake linux-headers
# NOTE: add these to run with LEDGER_ENABLED=true
# RUN apk add libusb-dev linux-headers

WORKDIR /code
COPY . /code/
COPY . src/mantlemint

# See https://github.com/CosmWasm/wasmvm/releases
ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.0.0/libwasmvm_muslc.x86_64.a /lib/libwasmvm_muslc.a

# NOTE: add libusb-dev to run with LEDGER_ENABLED=true
RUN set -eux &&\
apk add --no-cache \
linux-headers \
ca-certificates \
build-base \
cmake \
git

# use mimalloc for musl
RUN git clone --depth 1 https://github.com/microsoft/mimalloc; cd mimalloc; mkdir build; cd build; cmake ..; make -j$(nproc); make install
RUN set -eux &&\
git clone --depth 1 https://github.com/microsoft/mimalloc src/mimalloc &&\
mkdir -p src/mimalloc/build &&\
cd src/mimalloc/build &&\
cmake .. &&\
make -j$(nproc) &&\
make install

# force it to use static lib (from above) not standard libgo_cosmwasm.so file
RUN LEDGER_ENABLED=false go build -work -tags muslc,linux -mod=readonly -ldflags="-extldflags '-L/code/mimalloc/build -lmimalloc -static'" -o build/mantlemint ./sync.go

FROM alpine:3.12
RUN set -eux &&\
cd src/mantlemint &&\
LEDGER_ENABLED=false \
go build -work \
-tags muslc,linux \
-mod=readonly \
-ldflags="-extldflags '-L/go/src/mimalloc/build -lmimalloc -static'" \
-o /go/bin/mantlemint \
./sync.go

###############################################################################
FROM alpine:3.14

WORKDIR /root

COPY --from=go-builder /code/build/mantlemint /usr/local/bin/mantlemint
COPY --from=go-builder /go/bin/mantlemint /usr/local/bin/mantlemint

RUN apk add bash

# rest server
# lcd & grpc ports
EXPOSE 1317
# grpc
EXPOSE 9090

CMD ["/usr/local/bin/mantlemint"]

0 comments on commit 4cb4efe

Please sign in to comment.