-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #256 from bianjieai/ori/docker_optimize
optimize image building
- Loading branch information
Showing
2 changed files
with
14 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |