mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-18 10:41:01 +00:00
docker: use alpine to slim down images (#1047)
This commit is contained in:
+16
-17
@@ -1,37 +1,36 @@
|
|||||||
FROM phusion/baseimage:0.10.1 as builder
|
FROM frolvlad/alpine-glibc AS builder
|
||||||
LABEL maintainer "chevdor@gmail.com"
|
LABEL maintainer="chevdor@gmail.com"
|
||||||
LABEL description="This is the build stage for Substrate. Here we create the binary."
|
LABEL description="This is the build stage for Substrate. Here we create the binary."
|
||||||
|
|
||||||
|
RUN apk add build-base \
|
||||||
|
cmake \
|
||||||
|
linux-headers \
|
||||||
|
openssl-dev && \
|
||||||
|
apk add --repository http://nl.alpinelinux.org/alpine/edge/community cargo
|
||||||
|
|
||||||
ARG PROFILE=release
|
ARG PROFILE=release
|
||||||
WORKDIR /substrate
|
WORKDIR /substrate
|
||||||
|
|
||||||
RUN apt-get update && \
|
|
||||||
apt-get upgrade -y && \
|
|
||||||
apt-get install -y cmake pkg-config libssl-dev git
|
|
||||||
|
|
||||||
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
|
|
||||||
|
|
||||||
COPY . /substrate
|
COPY . /substrate
|
||||||
|
|
||||||
RUN export PATH=$PATH:$HOME/.cargo/bin && cargo build --$PROFILE
|
RUN cargo build --$PROFILE
|
||||||
|
|
||||||
# ===== SECOND STAGE ======
|
# ===== SECOND STAGE ======
|
||||||
|
|
||||||
FROM phusion/baseimage:0.10.0
|
FROM alpine:3.8
|
||||||
LABEL maintainer "chevdor@gmail.com"
|
LABEL maintainer="chevdor@gmail.com"
|
||||||
LABEL description="This is the 2nd stage: a very small image where we copy the Substrate binary."
|
LABEL description="This is the 2nd stage: a very small image where we copy the Substrate binary."
|
||||||
ARG PROFILE=release
|
ARG PROFILE=release
|
||||||
COPY --from=builder /substrate/target/$PROFILE/substrate /usr/local/bin
|
COPY --from=builder /substrate/target/$PROFILE/substrate /usr/local/bin
|
||||||
|
|
||||||
RUN mv /usr/share/ca* /tmp && \
|
RUN apk add --no-cache ca-certificates \
|
||||||
rm -rf /usr/share/* && \
|
libstdc++ \
|
||||||
mv /tmp/ca-certificates /usr/share/ && \
|
openssl
|
||||||
rm -rf /usr/lib/python* && \
|
|
||||||
|
RUN rm -rf /usr/lib/python* && \
|
||||||
mkdir -p /root/.local/share/Substrate && \
|
mkdir -p /root/.local/share/Substrate && \
|
||||||
ln -s /root/.local/share/Substrate /data
|
ln -s /root/.local/share/Substrate /data
|
||||||
|
|
||||||
RUN rm -rf /usr/bin /usr/sbin
|
|
||||||
|
|
||||||
EXPOSE 30333 9933 9944
|
EXPOSE 30333 9933 9944
|
||||||
VOLUME ["/data"]
|
VOLUME ["/data"]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user