Skip to content

Commit

Permalink
Merge pull request #256 from bianjieai/ori/docker_optimize
Browse files Browse the repository at this point in the history
optimize image building
  • Loading branch information
zhangyelong authored Jun 1, 2023
2 parents e863dbf + f67af49 commit c3fddfa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 30 deletions.
34 changes: 4 additions & 30 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,56 +1,30 @@
#
# Build image: docker build -t bianjie/irita .
#
FROM golang:1.17.3-alpine3.14 as builder

# 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 CosmWasm toolchain, etc
RUN set -eux; apk add --no-cache ca-certificates build-base;

# Set up dependencies
ENV PACKAGES make gcc git libc-dev bash openssl
FROM bianjie/irita-builder:v3 as builder

WORKDIR /irita

# Add source files
COPY . .

# Install minimum necessary dependencies
RUN apk add $PACKAGES

# NOTE: add these to run with LEDGER_ENABLED=true
# RUN apk add libusb-dev linux-headers

# See https://github.com/CosmWasm/wasmvm/releases
ADD https://github.com/CosmWasm/wasmvm/releases/download/v0.16.0/libwasmvm_muslc.a /lib/libwasmvm_muslc.a
RUN sha256sum /lib/libwasmvm_muslc.a | grep ef294a7a53c8d0aa6a8da4b10e94fb9f053f9decf160540d6c7594734bc35cd6
RUN go mod tidy

RUN LEDGER_ENABLED=false BUILD_TAGS=muslc make build

# ----------------------------

FROM ubuntu:16.04
FROM bianjie/irita-runner:ubuntu

# Set up dependencies
ENV PACKAGES make gcc perl wget

WORKDIR /

# Install openssl 3.0.0
RUN apt-get update && apt-get install $PACKAGES -y \
&& wget https://github.com/openssl/openssl/archive/openssl-3.0.0-alpha4.tar.gz \
&& tar -xzvf openssl-3.0.0-alpha4.tar.gz \
&& cd openssl-openssl-3.0.0-alpha4 && ./config \
&& make install \
&& cd ../ && rm -fr *openssl-3.0.0-alpha4* \
&& apt-get remove --purge $PACKAGES -y && apt-get autoremove -y

# p2p port
EXPOSE 26656
# rpc port
EXPOSE 26657
# metrics port
EXPOSE 26660

COPY --from=builder /irita/build/ /usr/local/bin/
COPY --from=builder /irita/build/irita /usr/local/bin/
10 changes: 10 additions & 0 deletions Dockerfile-builder
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#
# Build image: docker build -t bianjie/irita-builder:v3:${irita_version} .
#
FROM bianjie/go-builder:1.18 as builder

WORKDIR /irita
# Add source files
COPY . .

RUN go mod tidy && cd / && rm -rf /irita

0 comments on commit c3fddfa

Please sign in to comment.