Dockerfile.alpine -> Dockerfile, update CI build scripts
This commit is contained in:
@@ -196,8 +196,8 @@ jobs:
|
|||||||
- checkout
|
- checkout
|
||||||
- setup_remote_docker
|
- setup_remote_docker
|
||||||
- run:
|
- run:
|
||||||
name: Build Docker artifact - demo
|
name: Build Docker artifact
|
||||||
command: docker build --pull -t "cosmwasm/wasmd-demo:${CIRCLE_SHA1}" .
|
command: docker build --pull -t "cosmwasm/wasmd:${CIRCLE_SHA1}" .
|
||||||
- run:
|
- run:
|
||||||
name: Push application Docker image to docker hub
|
name: Push application Docker image to docker hub
|
||||||
command: |
|
command: |
|
||||||
@@ -216,13 +216,13 @@ jobs:
|
|||||||
- checkout
|
- checkout
|
||||||
- setup_remote_docker
|
- setup_remote_docker
|
||||||
- run:
|
- run:
|
||||||
name: Build Docker artifact - demo
|
name: Build Docker artifact
|
||||||
command: docker build --pull -t "cosmwasm/wasmd-demo:${CIRCLE_TAG}" .
|
command: docker build --pull -t "cosmwasm/wasmd:${CIRCLE_TAG}" .
|
||||||
- run:
|
- run:
|
||||||
name: Push application Docker image to docker hub
|
name: Push application Docker image to docker hub
|
||||||
command: |
|
command: |
|
||||||
docker login --password-stdin -u "$DOCKER_USER" \<<<"$DOCKER_PASS"
|
docker login --password-stdin -u "$DOCKER_USER" \<<<"$DOCKER_PASS"
|
||||||
docker push "cosmwasm/wasmd-demo:${CIRCLE_TAG}"
|
docker push "cosmwasm/wasmd:${CIRCLE_TAG}"
|
||||||
docker logout
|
docker logout
|
||||||
|
|
||||||
reproducible-builds:
|
reproducible-builds:
|
||||||
|
|||||||
55
Dockerfile
55
Dockerfile
@@ -1,28 +1,39 @@
|
|||||||
# Simple usage with a mounted data directory:
|
# docker build . -t cosmwasm/wasm:latest
|
||||||
# > docker build -t gaia .
|
# docker run --rm -it cosmwasm/wasm:latest /bin/sh
|
||||||
# > docker run -it -p 46657:46657 -p 46656:46656 -v ~/.wasmd:/root/.wasmd -v ~/.wasmcli:/root/.wasmcli gaia wasmd init
|
FROM cosmwasm/go-ext-builder:0.8.2-alpine AS builder
|
||||||
# > docker run -it -p 46657:46657 -p 46656:46656 -v ~/.wasmd:/root/.wasmd -v ~/.wasmcli:/root/.wasmcli gaia wasmd start
|
|
||||||
FROM golang:1.13-buster AS build-env
|
|
||||||
|
|
||||||
# Install minimum necessary dependencies, build Cosmos SDK, remove packages
|
RUN apk add git
|
||||||
RUN apt update
|
# without this, build with LEDGER_ENABLED=false
|
||||||
RUN apt install -y curl git build-essential
|
RUN apk add libusb-dev linux-headers
|
||||||
# debug: for live editting in the image
|
|
||||||
RUN apt install -y vim
|
|
||||||
|
|
||||||
# Set working directory for the build
|
# copy all code into /code
|
||||||
WORKDIR /go/src/github.com/cosmwasm/wasmd
|
WORKDIR /code
|
||||||
|
COPY . /code
|
||||||
|
|
||||||
# Add source files
|
# download all deps
|
||||||
COPY . .
|
RUN go mod download
|
||||||
#
|
# TODO: how to use this instead of hardcoding GO_COSMWASM
|
||||||
RUN make tools
|
RUN basename $(ls -d /go/pkg/mod/github.com/\!cosm\!wasm/go-cosmwasm@v*)
|
||||||
RUN make install
|
|
||||||
|
|
||||||
# Install libgo_cosmwasm.so to a shared directory where it is readable by all users
|
ENV GO_COSMWASM="v0.8.2-0.20200615221537-0fc920db0349"
|
||||||
# See https://github.com/CosmWasm/wasmd/issues/43#issuecomment-608366314
|
|
||||||
# Note that CosmWasm gets turned into !cosm!wasm in the pkg/mod cache
|
# build go-cosmwasm *.a and install it
|
||||||
RUN cp /go/pkg/mod/github.com/\!cosm\!wasm/go-cosmwasm@v*/api/libgo_cosmwasm.so /lib/x86_64-linux-gnu
|
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/
|
COPY docker/* /opt/
|
||||||
RUN chmod +x /opt/*.sh
|
RUN chmod +x /opt/*.sh
|
||||||
@@ -36,4 +47,4 @@ EXPOSE 26656
|
|||||||
# tendermint rpc
|
# tendermint rpc
|
||||||
EXPOSE 26657
|
EXPOSE 26657
|
||||||
|
|
||||||
CMD ["wasmd"]
|
CMD ["/usr/bin/wasmd version"]
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
# 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"]
|
|
||||||
39
Dockerfile.old
Normal file
39
Dockerfile.old
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
# Simple usage with a mounted data directory:
|
||||||
|
# > docker build -t gaia .
|
||||||
|
# > docker run -it -p 46657:46657 -p 46656:46656 -v ~/.wasmd:/root/.wasmd -v ~/.wasmcli:/root/.wasmcli gaia wasmd init
|
||||||
|
# > docker run -it -p 46657:46657 -p 46656:46656 -v ~/.wasmd:/root/.wasmd -v ~/.wasmcli:/root/.wasmcli gaia wasmd start
|
||||||
|
FROM golang:1.13-buster AS build-env
|
||||||
|
|
||||||
|
# Install minimum necessary dependencies, build Cosmos SDK, remove packages
|
||||||
|
RUN apt update
|
||||||
|
RUN apt install -y curl git build-essential
|
||||||
|
# debug: for live editting in the image
|
||||||
|
RUN apt install -y vim
|
||||||
|
|
||||||
|
# Set working directory for the build
|
||||||
|
WORKDIR /go/src/github.com/cosmwasm/wasmd
|
||||||
|
|
||||||
|
# Add source files
|
||||||
|
COPY . .
|
||||||
|
#
|
||||||
|
RUN make tools
|
||||||
|
RUN make install
|
||||||
|
|
||||||
|
# Install libgo_cosmwasm.so to a shared directory where it is readable by all users
|
||||||
|
# See https://github.com/CosmWasm/wasmd/issues/43#issuecomment-608366314
|
||||||
|
# Note that CosmWasm gets turned into !cosm!wasm in the pkg/mod cache
|
||||||
|
RUN cp /go/pkg/mod/github.com/\!cosm\!wasm/go-cosmwasm@v*/api/libgo_cosmwasm.so /lib/x86_64-linux-gnu
|
||||||
|
|
||||||
|
COPY docker/* /opt/
|
||||||
|
RUN chmod +x /opt/*.sh
|
||||||
|
|
||||||
|
WORKDIR /opt
|
||||||
|
|
||||||
|
# rest server
|
||||||
|
EXPOSE 1317
|
||||||
|
# tendermint p2p
|
||||||
|
EXPOSE 26656
|
||||||
|
# tendermint rpc
|
||||||
|
EXPOSE 26657
|
||||||
|
|
||||||
|
CMD ["wasmd"]
|
||||||
@@ -17,11 +17,16 @@ hardware it runs on.
|
|||||||
| v0.7 | v0.38 |
|
| v0.7 | v0.38 |
|
||||||
| v0.8 | v0.38 |
|
| v0.8 | v0.38 |
|
||||||
|
|
||||||
We currently only support Intel/AMD64 CPUs and OSX or Linux (with glibc - not muslc like alpine).
|
We currently only support Intel/AMD64 CPUs and OSX or Linux. For Linux, the standard build
|
||||||
This limit comes from the Rust dll we use to run the wasm code. There are open issues
|
commands work for `glibc` systems (Ubuntu, Debian, CentOS, etc). If you wish to compile
|
||||||
for adding [ARM support](https://github.com/CosmWasm/go-cosmwasm/issues/53),
|
for a `muslc` based system (like alpine), you need to compile a static library go-cosmwasm locally
|
||||||
adding [Windows support](https://github.com/CosmWasm/go-cosmwasm/issues/28),
|
and compile go with the `muslc` build tag. Or just use the [Dockerfile](./Dockerfile),
|
||||||
and [compiling static binaries](https://github.com/CosmWasm/go-cosmwasm/issues/45), so it works on both glibc and muslc systems.
|
which builds a static go binary in an alpine system.
|
||||||
|
|
||||||
|
This limit comes from the Rust dll we use to run the wasm code, which comes
|
||||||
|
from [`go-cosmwasm`](https://github.com/CosmWasm/go-cosmwasm). There are open issues
|
||||||
|
for adding [ARM support](https://github.com/CosmWasm/go-cosmwasm/issues/53), and
|
||||||
|
adding [Windows support](https://github.com/CosmWasm/go-cosmwasm/issues/28).
|
||||||
However, these issues are not high on the roadmap and unless you are championing
|
However, these issues are not high on the roadmap and unless you are championing
|
||||||
them, please count on the current limits for the near future.
|
them, please count on the current limits for the near future.
|
||||||
|
|
||||||
|
|||||||
@@ -49,13 +49,14 @@ If you want to deploy a whole cluster, [look at the network scripts](./networks/
|
|||||||
|
|
||||||
We provide a docker image to help with test setups. There are two modes to use it
|
We provide a docker image to help with test setups. There are two modes to use it
|
||||||
|
|
||||||
Build: `docker build -t cosmwasm/wasmd:manual .` or pull from dockerhub
|
Build: `docker build -t cosmwasm/wasmd:latest .` or pull from dockerhub
|
||||||
|
|
||||||
### Dev server
|
### Dev server
|
||||||
|
|
||||||
Bring up a local node with a test account containing tokens
|
Bring up a local node with a test account containing tokens
|
||||||
|
|
||||||
This is just designed for local testing/CI - DO NOT USE IN PRODUCTION
|
This is just designed for local testing/CI - do not use these scripts in production.
|
||||||
|
Very likely you will assign tokens to accounts whose mnemonics are public on github.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
docker volume rm -f wasmd_data
|
docker volume rm -f wasmd_data
|
||||||
|
|||||||
2
go.mod
2
go.mod
@@ -3,7 +3,7 @@ module github.com/CosmWasm/wasmd
|
|||||||
go 1.13
|
go 1.13
|
||||||
|
|
||||||
require (
|
require (
|
||||||
// Note: update ENV GO_COSMWASM in Dockerfile.alpine when updating this
|
// Note: update ENV GO_COSMWASM in Dockerfile when updating this
|
||||||
github.com/CosmWasm/go-cosmwasm v0.8.2-0.20200615221537-0fc920db0349
|
github.com/CosmWasm/go-cosmwasm v0.8.2-0.20200615221537-0fc920db0349
|
||||||
github.com/btcsuite/btcd v0.0.0-20190807005414-4063feeff79a // indirect
|
github.com/btcsuite/btcd v0.0.0-20190807005414-4063feeff79a // indirect
|
||||||
github.com/cosmos/cosmos-sdk v0.38.3
|
github.com/cosmos/cosmos-sdk v0.38.3
|
||||||
|
|||||||
Reference in New Issue
Block a user