generated from BlockchainCommons/secure-template
-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Dockerfile
32 lines (31 loc) · 1 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
FROM ubuntu:20.04 as build-stage
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update -y
# Install build dependencies
RUN apt-get install -y git
RUN apt-get install -y build-essential
RUN apt-get install -y libc++-10-dev libc++abi-10-dev
RUN apt-get install -y lsb-release wget software-properties-common
RUN wget https://apt.llvm.org/llvm.sh
RUN chmod +x llvm.sh
RUN ./llvm.sh 10 # version 10
# Build seedtool-cli
ENV CC="clang-10"
ENV CXX="clang++-10"
COPY . /seedtool-cli
WORKDIR /seedtool-cli
RUN git submodule update --init --recursive
RUN CC="clang-10" CXX="clang++-10" ./build.sh
# Export built executable to a minimal runtime image and run as an unprivileged
# user.
FROM ubuntu:20.04
ARG DEBIAN_FRONTEND=noninteractive
# Install runtime dependencies
RUN apt-get update -y
RUN apt-get install -y libc++1 libc++abi1
# Install binary
COPY --from=build-stage /seedtool-cli/src/seedtool /usr/local/bin/seedtool
# Create an unprivileged user
RUN useradd --create-home --user-group user
USER user
ENTRYPOINT ["seedtool"]