Docker alpine: use multi-stage concept (#9269)
* Docker alpine: use multi-stage concept * Docker alpine: create config directory
This commit is contained in:
parent
e590874a81
commit
65a1d88907
@ -1,29 +1,43 @@
|
|||||||
FROM alpine:edge
|
FROM alpine:edge AS builder
|
||||||
|
|
||||||
WORKDIR /build
|
|
||||||
|
|
||||||
# install tools and dependencies
|
|
||||||
RUN apk add --no-cache gcc musl-dev pkgconfig g++ make curl \
|
|
||||||
eudev-dev rust cargo git file binutils \
|
|
||||||
libusb-dev linux-headers perl cmake
|
|
||||||
|
|
||||||
# show backtraces
|
# show backtraces
|
||||||
ENV RUST_BACKTRACE 1
|
ENV RUST_BACKTRACE 1
|
||||||
|
|
||||||
# show tools
|
RUN apk add --no-cache \
|
||||||
RUN rustc -vV && \
|
build-base \
|
||||||
cargo -V && \
|
cargo \
|
||||||
gcc -v &&\
|
cmake \
|
||||||
g++ -v
|
eudev-dev \
|
||||||
|
linux-headers \
|
||||||
|
perl \
|
||||||
|
rust
|
||||||
|
|
||||||
# build parity
|
WORKDIR /parity
|
||||||
ADD . /build/parity
|
COPY . /parity
|
||||||
RUN cd parity && \
|
RUN cargo build --release --target x86_64-alpine-linux-musl --verbose
|
||||||
cargo build --release --verbose && \
|
RUN strip target/x86_64-alpine-linux-musl/release/parity
|
||||||
ls /build/parity/target/release/parity && \
|
|
||||||
strip /build/parity/target/release/parity
|
|
||||||
|
|
||||||
RUN file /build/parity/target/release/parity
|
|
||||||
|
FROM alpine:edge
|
||||||
|
|
||||||
|
# show backtraces
|
||||||
|
ENV RUST_BACKTRACE 1
|
||||||
|
|
||||||
|
RUN apk add --no-cache \
|
||||||
|
libstdc++ \
|
||||||
|
eudev-libs \
|
||||||
|
libgcc
|
||||||
|
|
||||||
|
RUN addgroup -g 1000 parity \
|
||||||
|
&& adduser -u 1000 -G parity -s /bin/sh -D parity
|
||||||
|
|
||||||
|
USER parity
|
||||||
|
|
||||||
EXPOSE 8080 8545 8180
|
EXPOSE 8080 8545 8180
|
||||||
ENTRYPOINT ["/build/parity/target/release/parity"]
|
|
||||||
|
WORKDIR /home/parity
|
||||||
|
|
||||||
|
RUN mkdir -p /home/parity/.local/share/io.parity.ethereum/
|
||||||
|
COPY --chown=parity:parity --from=builder /parity/target/x86_64-alpine-linux-musl/release/parity ./
|
||||||
|
|
||||||
|
ENTRYPOINT ["./parity"]
|
||||||
|
Loading…
Reference in New Issue
Block a user