-
Notifications
You must be signed in to change notification settings - Fork 412
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #139 from CosmWasm/alpine-docker
Use alpine to build wasmd docker image
- Loading branch information
Showing
12 changed files
with
81 additions
and
26 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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# docker build . -t wasm-alpine -f ./Dockerfile.alpine | ||
# docker run --rm -it wasm-alpine /bin/sh | ||
FROM cosmwasm/go-ext-builder:0.8.2-alpine AS builder | ||
|
||
RUN apk add git | ||
# without this, build with LEDGER_ENABLED=false | ||
RUN apk add libusb-dev linux-headers | ||
|
||
# copy all code into /code | ||
WORKDIR /code | ||
COPY . /code | ||
|
||
# download all deps | ||
RUN go mod download | ||
# TODO: how to use this instead of hardcoding GO_COSMWASM | ||
RUN basename $(ls -d /go/pkg/mod/github.com/\!cosm\!wasm/go-cosmwasm@v*) | ||
|
||
ENV GO_COSMWASM="v0.8.2-0.20200615221537-0fc920db0349" | ||
|
||
# build go-cosmwasm *.a and install it | ||
WORKDIR /go/pkg/mod/github.com/\!cosm\!wasm/go-cosmwasm@${GO_COSMWASM} | ||
RUN cargo build --release --features backtraces --example muslc | ||
RUN mv /go/pkg/mod/github.com/\!cosm\!wasm/go-cosmwasm@${GO_COSMWASM}/target/release/examples/libmuslc.a /lib/libgo_cosmwasm_muslc.a | ||
# I got errors from go mod verify (called from make build) if I didn't clean this up | ||
RUN rm -rf /go/pkg/mod/github.com/\!cosm\!wasm/go-cosmwasm@${GO_COSMWASM}/target | ||
|
||
# build the go wasm binary | ||
WORKDIR /code | ||
|
||
# force it to use static lib (from above) not standard libgo_cosmwasm.so file | ||
RUN BUILD_TAGS=muslc make build | ||
|
||
FROM alpine:3.12 | ||
|
||
COPY --from=builder /code/build/wasmd /usr/bin/wasmd | ||
COPY --from=builder /code/build/wasmcli /usr/bin/wasmcli | ||
|
||
COPY docker/* /opt/ | ||
RUN chmod +x /opt/*.sh | ||
|
||
WORKDIR /opt | ||
|
||
# rest server | ||
EXPOSE 1317 | ||
# tendermint p2p | ||
EXPOSE 26656 | ||
# tendermint rpc | ||
EXPOSE 26657 | ||
|
||
CMD ["/usr/bin/wasmd version"] |
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,3 +1,3 @@ | ||
#!/bin/bash | ||
#!/bin/sh | ||
|
||
tail -f /root/log/wasmd.log |
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,11 +1,11 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
#!/bin/sh | ||
#set -euo pipefail | ||
|
||
mkdir -p /root/log | ||
touch /root/log/wasmd.log | ||
./run_wasmd.sh >> /root/log/wasmd.log & | ||
./run_wasmd.sh $1 >> /root/log/wasmd.log & | ||
|
||
sleep 4 | ||
echo Starting Rest Server... | ||
|
||
./run_wasmcli.sh | ||
./run_rest_server.sh |
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,4 +1,4 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
#!/bin/sh | ||
#set -euo pipefail | ||
|
||
wasmcli rest-server --laddr tcp://0.0.0.0:1317 --trust-node --cors |
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,4 +1,4 @@ | ||
#!/bin/bash | ||
#!/bin/sh | ||
|
||
if test -n "$1"; then | ||
# need -R not -r to copy hidden files | ||
|
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