Skip to content

Docker Container Fails to Start After Setup #4

Description

@emochka2007

Recently, I've encountered an issue where my Docker container fails immediately after setup. The container does not stay up and exits right after initialization.
Screenshot 2024-11-19 at 12 54 46
Screenshot 2024-11-19 at 12 55 06

FROM golang:1.20-alpine AS go-builder
#ARG arch=x86_64

# See https://github.com/CosmWasm/wasmvm/releases -> pick latest stable release
ENV LIBWASMVM_VERSION=v1.5.5

# 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 curl --no-cache wget git cmake libusb-dev linux-headers tar gzip
# NOTE: add these to run with LEDGER_ENABLED=true
# RUN apk add libusb-dev linux-headers

WORKDIR /code

RUN curl -L https://github.com/phoenix-directive/core/archive/refs/tags/v2.12.5.tar.gz -o ./terrad.tar.gz
RUN tar -xzf terrad.tar.gz && rm -f terrad.tar.gz
RUN mv */* /code/

RUN curl -L https://snapshots.polkachu.com/genesis/terra/genesis.json -o genesis.json
RUN curl -L https://snapshots.polkachu.com/addrbook/terra/addrbook.json -o addrbook.json

# Install mimalloc
RUN git clone --depth 1 https://github.com/microsoft/mimalloc; cd mimalloc; mkdir build; cd build; cmake ..; make -j$(nproc); make install
ENV MIMALLOC_RESERVE_HUGE_OS_PAGES=4

# See https://github.com/CosmWasm/wasmvm/releases
ADD https://github.com/CosmWasm/wasmvm/releases/download/${LIBWASMVM_VERSION}/libwasmvm_muslc.aarch64.a /lib/libwasmvm_muslc.aarch64.a
ADD https://github.com/CosmWasm/wasmvm/releases/download/${LIBWASMVM_VERSION}/libwasmvm_muslc.x86_64.a /lib/libwasmvm_muslc.x86_64.a
#RUN sha256sum /lib/libwasmvm_muslc.aarch64.a | grep 7d2239e9f25e96d0d4daba982ce92367aacf0cbd95d2facb8442268f2b1cc1fc
#RUN sha256sum /lib/libwasmvm_muslc.x86_64.a | grep f6282df732a13dec836cda1f399dd874b1e3163504dbd9607c6af915b2740479

# Copy the library you want to the final location that will be found by the linker flag `-lwasmvm_muslc`
RUN cp /lib/libwasmvm_muslc.`uname -m`.a /lib/libwasmvm_muslc.a

# force it to use static lib (from above) not standard libgo_cosmwasm.so file
RUN LEDGER_ENABLED=false BUILD_TAGS=muslc LDFLAGS="-linkmode=external -extldflags \"-L/code/mimalloc/build -lmimalloc -Wl,-z,muldefs -static\"" make build

FROM alpine:3.15.4

RUN addgroup terra \
    && adduser -G terra -D -h /terra terra

WORKDIR /terra

COPY --from=go-builder /code/build/terrad /usr/local/bin/terrad
COPY --from=go-builder /code/genesis.json /root/.terra/config/genesis.json
COPY --from=go-builder /code/addrbook.json /root/.terra/config/addrbook.json

USER 0

# rest server
EXPOSE 1317
# grpc
EXPOSE 9090
# tendermint p2p
EXPOSE 26656
# tendermint rpc
EXPOSE 26657


ENTRYPOINT ["terrad"]

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions