Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Docker alpine: use multi-stage concept (#9269)
Browse files Browse the repository at this point in the history
* Docker alpine: use multi-stage concept

* Docker alpine: create config directory
  • Loading branch information
fanatid authored and debris committed Aug 10, 2018
1 parent e590874 commit 65a1d88
Showing 1 changed file with 33 additions and 19 deletions.
52 changes: 33 additions & 19 deletions docker/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,43 @@
FROM alpine:edge
FROM alpine:edge AS builder

# show backtraces
ENV RUST_BACKTRACE 1

RUN apk add --no-cache \
build-base \
cargo \
cmake \
eudev-dev \
linux-headers \
perl \
rust

WORKDIR /build
WORKDIR /parity
COPY . /parity
RUN cargo build --release --target x86_64-alpine-linux-musl --verbose
RUN strip target/x86_64-alpine-linux-musl/release/parity

# 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

FROM alpine:edge

# show backtraces
ENV RUST_BACKTRACE 1

# show tools
RUN rustc -vV && \
cargo -V && \
gcc -v &&\
g++ -v
RUN apk add --no-cache \
libstdc++ \
eudev-libs \
libgcc

# build parity
ADD . /build/parity
RUN cd parity && \
cargo build --release --verbose && \
ls /build/parity/target/release/parity && \
strip /build/parity/target/release/parity
RUN addgroup -g 1000 parity \
&& adduser -u 1000 -G parity -s /bin/sh -D parity

RUN file /build/parity/target/release/parity
USER parity

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"]

0 comments on commit 65a1d88

Please sign in to comment.