forked from zeitgeistpm/zeitgeist
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
52 lines (35 loc) · 1.39 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Based from https://github.com/paritytech/substrate/blob/master/.maintain/Dockerfile
FROM phusion/baseimage:jammy-1.0.1 as builder
LABEL maintainer="[email protected]"
LABEL description="This is the build stage for the Zeitgeist node. Here is created the binary."
ENV DEBIAN_FRONTEND=noninteractive
ARG PROFILE=production
ARG FEATURES=default
WORKDIR /zeitgeist
COPY . /zeitgeist
RUN apt-get update && \
apt-get upgrade -y -o Dpkg::Options::="--force-confold"
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN ./scripts/init.sh nosudo
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN . "$HOME/.cargo/env" && cargo build --profile "$PROFILE" --features "$FEATURES"
# ==== SECOND STAGE ====
FROM phusion/baseimage:jammy-1.0.1
LABEL maintainer="[email protected]"
LABEL description="This is the 2nd stage: a very small image where we copy the Zeigeist node binary."
ARG PROFILE=production
RUN mv /usr/share/ca* /tmp && \
rm -rf /usr/share/* && \
mv /tmp/ca-certificates /usr/share/ && \
useradd -m -u 1000 -U -s /bin/sh -d /zeitgeist zeitgeist
COPY --from=builder /zeitgeist/target/$PROFILE/zeitgeist /usr/local/bin
# checks
RUN ldd /usr/local/bin/zeitgeist && \
/usr/local/bin/zeitgeist --version
# Shrinking
RUN rm -rf /usr/lib/python* && rm -rf /usr/share/man
USER zeitgeist
EXPOSE 30333 9933 9944
RUN mkdir -p /zeitgeist/data
VOLUME ["/zeitgeist/data"]
ENTRYPOINT ["/usr/local/bin/zeitgeist"]