Dockerfile.alpine has all scripts from original Dockerfile, use for release builds

This commit is contained in:
Ethan Frey
2020-06-16 00:25:44 +02:00
parent e002f39b62
commit d6c3be9db4
9 changed files with 36 additions and 24 deletions

View File

@@ -197,12 +197,12 @@ jobs:
- setup_remote_docker - setup_remote_docker
- run: - run:
name: Build Docker artifact - demo 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: - run:
name: Push application Docker image to docker hub name: Push application Docker image to docker hub
command: | command: |
if [ "${CIRCLE_BRANCH}" = "master" ]; then 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 login --password-stdin -u "$DOCKER_USER" \<<<"$DOCKER_PASS"
docker push cosmwasm/wasmd-demo:latest docker push cosmwasm/wasmd-demo:latest
docker logout docker logout

View File

@@ -1,12 +1,12 @@
# docker build . -t wasm-alpine -f ./Dockerfile.alpine # docker build . -t wasm-alpine -f ./Dockerfile.alpine
# docker run --rm -it wasm-alpine /bin/sh # 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 RUN apk add git
# without this, build with LEDGER_ENABLED=false # without this, build with LEDGER_ENABLED=false
RUN apk add libusb-dev linux-headers 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 # copy all code into /code
WORKDIR /code WORKDIR /code
@@ -35,8 +35,21 @@ WORKDIR /code
RUN BUILD_TAGS=muslc make build RUN BUILD_TAGS=muslc make build
# TODO: try scratch
FROM alpine:3.12 FROM alpine:3.12
COPY --from=builder /code/build/wasmd /usr/bin/wasmd COPY --from=builder /code/build/wasmd /usr/bin/wasmd
CMD ["/usr/bin/wasmd help"] 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"]

View File

@@ -90,7 +90,6 @@ install: go.sum
go install -mod=readonly $(BUILD_FLAGS) ./cmd/wasmd go install -mod=readonly $(BUILD_FLAGS) ./cmd/wasmd
go install -mod=readonly $(BUILD_FLAGS) ./cmd/wasmcli go install -mod=readonly $(BUILD_FLAGS) ./cmd/wasmcli
######################################## ########################################
### Documentation ### Documentation

View File

@@ -65,17 +65,17 @@ docker volume rm -f wasmd_data
docker run --rm -it \ docker run --rm -it \
-e PASSWORD=xxxxxxxxx \ -e PASSWORD=xxxxxxxxx \
--mount type=volume,source=wasmd_data,target=/root \ --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 # 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 \ docker run --rm -it -p 26657:26657 -p 26656:26656 -p 1317:1317 \
--mount type=volume,source=wasmd_data,target=/root \ --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 # view wasmd logs in another shell
docker run --rm -it \ docker run --rm -it \
--mount type=volume,source=wasmd_data,target=/root,readonly \ --mount type=volume,source=wasmd_data,target=/root,readonly \
cosmwasm/wasmd-demo:latest ./logs.sh cosmwasm/wasmd:latest ./logs.sh
``` ```
### CI ### CI
@@ -88,7 +88,7 @@ rm -rf ./template && mkdir ./template
docker run --rm -it \ docker run --rm -it \
-e PASSWORD=xxxxxxxxx \ -e PASSWORD=xxxxxxxxx \
--mount type=bind,source=$(pwd)/template,target=/root \ --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 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 \ docker run --rm -it -p 26657:26657 -p 26656:26656 -p 1317:1317 \
--mount type=bind,source=$(pwd)/template,target=/template \ --mount type=bind,source=$(pwd)/template,target=/template \
--mount type=volume,source=wasmd_data,target=/root \ --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 # RESTART CHAIN with existing state
docker run --rm -it -p 26657:26657 -p 26656:26656 -p 1317:1317 \ docker run --rm -it -p 26657:26657 -p 26656:26656 -p 1317:1317 \
--mount type=volume,source=wasmd_data,target=/root \ --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 # view wasmd logs in another shell
docker run --rm -it \ docker run --rm -it \
--mount type=volume,source=wasmd_data,target=/root,readonly \ --mount type=volume,source=wasmd_data,target=/root,readonly \
cosmwasm/wasmd-demo:latest ./logs.sh cosmwasm/wasmd:latest ./logs.sh
``` ```
## Contributors ## Contributors

View File

@@ -1,3 +1,3 @@
#!/bin/bash #!/bin/sh
tail -f /root/log/wasmd.log tail -f /root/log/wasmd.log

View File

@@ -1,11 +1,11 @@
#!/bin/bash #!/bin/sh
set -euo pipefail #set -euo pipefail
mkdir -p /root/log mkdir -p /root/log
touch /root/log/wasmd.log touch /root/log/wasmd.log
./run_wasmd.sh >> /root/log/wasmd.log & ./run_wasmd.sh $1 >> /root/log/wasmd.log &
sleep 4 sleep 4
echo Starting Rest Server... echo Starting Rest Server...
./run_wasmcli.sh ./run_rest_server.sh

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/bin/sh
set -euo pipefail #set -euo pipefail
wasmcli rest-server --laddr tcp://0.0.0.0:1317 --trust-node --cors wasmcli rest-server --laddr tcp://0.0.0.0:1317 --trust-node --cors

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/bin/sh
if test -n "$1"; then if test -n "$1"; then
# need -R not -r to copy hidden files # need -R not -r to copy hidden files

View File

@@ -1,5 +1,5 @@
#!/bin/bash #!/bin/sh
set -o errexit -o nounset -o pipefail #set -o errexit -o nounset -o pipefail
PASSWORD=${PASSWORD:-1234567890} PASSWORD=${PASSWORD:-1234567890}
STAKE=${STAKE_TOKEN:-ustake} STAKE=${STAKE_TOKEN:-ustake}