From d6c3be9db40e96b4c43f64951244cf86f57a3703 Mon Sep 17 00:00:00 2001 From: Ethan Frey Date: Tue, 16 Jun 2020 00:25:44 +0200 Subject: [PATCH] Dockerfile.alpine has all scripts from original Dockerfile, use for release builds --- .circleci/config.yml | 4 ++-- Dockerfile.alpine | 21 +++++++++++++++++---- Makefile | 1 - README.md | 14 +++++++------- docker/logs.sh | 2 +- docker/run_all.sh | 8 ++++---- docker/run_rest_server.sh | 4 ++-- docker/run_wasmd.sh | 2 +- docker/setup.sh | 4 ++-- 9 files changed, 36 insertions(+), 24 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ae9f886f..d5bf24b2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -197,12 +197,12 @@ jobs: - setup_remote_docker - run: name: Build Docker artifact - demo - command: docker build --pull -t "cosmwasm/wasmd-demo:${CIRCLE_SHA1}" . + command: docker build --pull -t "cosmwasm/wasmd:${CIRCLE_SHA1}" . -f Dockerfile.alpine - run: name: Push application Docker image to docker hub command: | if [ "${CIRCLE_BRANCH}" = "master" ]; then - docker tag "cosmwasm/wasmd-demo:${CIRCLE_SHA1}" cosmwasm/wasmd-demo:latest + docker tag "cosmwasm/wasmd:${CIRCLE_SHA1}" cosmwasm/wasmd:latest docker login --password-stdin -u "$DOCKER_USER" \<<<"$DOCKER_PASS" docker push cosmwasm/wasmd-demo:latest docker logout diff --git a/Dockerfile.alpine b/Dockerfile.alpine index d37954cb..a2669653 100644 --- a/Dockerfile.alpine +++ b/Dockerfile.alpine @@ -1,12 +1,12 @@ # docker build . -t wasm-alpine -f ./Dockerfile.alpine # docker run --rm -it wasm-alpine /bin/sh -FROM cosmwasm/go-ext-builder:0.8.1-alpine-combi AS builder +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 -ENV GO_COSMWASM="v0.8.2-0.20200610212608-c0f4fd4f6b74" +ENV GO_COSMWASM="v0.8.2-0.20200615215318-6f82d95b1cb6" # copy all code into /code WORKDIR /code @@ -35,8 +35,21 @@ WORKDIR /code RUN BUILD_TAGS=muslc make build -# TODO: try scratch FROM alpine:3.12 COPY --from=builder /code/build/wasmd /usr/bin/wasmd -CMD ["/usr/bin/wasmd help"] \ No newline at end of file +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"] \ No newline at end of file diff --git a/Makefile b/Makefile index 1b046d51..ec3bfabe 100644 --- a/Makefile +++ b/Makefile @@ -90,7 +90,6 @@ install: go.sum go install -mod=readonly $(BUILD_FLAGS) ./cmd/wasmd go install -mod=readonly $(BUILD_FLAGS) ./cmd/wasmcli - ######################################## ### Documentation diff --git a/README.md b/README.md index e6de6d67..7f637605 100644 --- a/README.md +++ b/README.md @@ -65,17 +65,17 @@ docker volume rm -f wasmd_data docker run --rm -it \ -e PASSWORD=xxxxxxxxx \ --mount type=volume,source=wasmd_data,target=/root \ - cosmwasm/wasmd-demo:latest ./setup.sh cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6 + cosmwasm/wasmd:latest ./setup.sh cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6 # This will start both wasmd and wasmcli rest-server, only wasmcli output is shown on the screen docker run --rm -it -p 26657:26657 -p 26656:26656 -p 1317:1317 \ --mount type=volume,source=wasmd_data,target=/root \ - cosmwasm/wasmd-demo:latest ./run_all.sh + cosmwasm/wasmd:latest ./run_all.sh # view wasmd logs in another shell docker run --rm -it \ --mount type=volume,source=wasmd_data,target=/root,readonly \ - cosmwasm/wasmd-demo:latest ./logs.sh + cosmwasm/wasmd:latest ./logs.sh ``` ### CI @@ -88,7 +88,7 @@ rm -rf ./template && mkdir ./template docker run --rm -it \ -e PASSWORD=xxxxxxxxx \ --mount type=bind,source=$(pwd)/template,target=/root \ - cosmwasm/wasmd-demo:latest ./setup.sh cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6 + cosmwasm/wasmd:latest ./setup.sh cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6 sudo chown -R $(id -u):$(id -g) ./template @@ -99,17 +99,17 @@ docker volume rm -f wasmd_data docker run --rm -it -p 26657:26657 -p 26656:26656 -p 1317:1317 \ --mount type=bind,source=$(pwd)/template,target=/template \ --mount type=volume,source=wasmd_data,target=/root \ - cosmwasm/wasmd-demo:latest ./run_all.sh /template + cosmwasm/wasmd:latest ./run_all.sh /template # RESTART CHAIN with existing state docker run --rm -it -p 26657:26657 -p 26656:26656 -p 1317:1317 \ --mount type=volume,source=wasmd_data,target=/root \ - cosmwasm/wasmd-demo:latest ./run_all.sh + cosmwasm/wasmd:latest ./run_all.sh # view wasmd logs in another shell docker run --rm -it \ --mount type=volume,source=wasmd_data,target=/root,readonly \ - cosmwasm/wasmd-demo:latest ./logs.sh + cosmwasm/wasmd:latest ./logs.sh ``` ## Contributors diff --git a/docker/logs.sh b/docker/logs.sh index fcd6b43b..f016b8de 100755 --- a/docker/logs.sh +++ b/docker/logs.sh @@ -1,3 +1,3 @@ -#!/bin/bash +#!/bin/sh tail -f /root/log/wasmd.log \ No newline at end of file diff --git a/docker/run_all.sh b/docker/run_all.sh index 586f5b85..f183d532 100755 --- a/docker/run_all.sh +++ b/docker/run_all.sh @@ -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 diff --git a/docker/run_rest_server.sh b/docker/run_rest_server.sh index 022ac541..368a90d3 100755 --- a/docker/run_rest_server.sh +++ b/docker/run_rest_server.sh @@ -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 diff --git a/docker/run_wasmd.sh b/docker/run_wasmd.sh index 04893f21..db08a949 100755 --- a/docker/run_wasmd.sh +++ b/docker/run_wasmd.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh if test -n "$1"; then # need -R not -r to copy hidden files diff --git a/docker/setup.sh b/docker/setup.sh index fec91b2b..d6829a1f 100755 --- a/docker/setup.sh +++ b/docker/setup.sh @@ -1,5 +1,5 @@ -#!/bin/bash -set -o errexit -o nounset -o pipefail +#!/bin/sh +#set -o errexit -o nounset -o pipefail PASSWORD=${PASSWORD:-1234567890} STAKE=${STAKE_TOKEN:-ustake}