-
Notifications
You must be signed in to change notification settings - Fork 18
/
Dockerfile
35 lines (27 loc) · 1.35 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
# This is a multi-stage docker file. See https://docs.docker.com/build/building/multi-stage/
# for details about this pattern.
# It is largely copied from Substrate
# https://github.com/paritytech/substrate/blob/master/docker/substrate_builder.Dockerfile
# For the build stage, we use an image provided by Parity
FROM docker.io/paritytech/ci-linux:production as builder
WORKDIR /node-template
COPY . /node-template
RUN cargo build --locked --release -p node-template
# For the second stage, we use a minimal Ubuntu image
# Alpine does't work as explained https://stackoverflow.com/a/66974607/4184410
# Also, surprisingly, `ubuntu:latest` doesn't work and leads to "OS can't spawn worker thread: Operation not permitted"
FROM docker.io/library/ubuntu:20.04
LABEL description="Tuxedo Node Template"
COPY --from=builder /node-template/target/release/node-template /usr/local/bin
RUN useradd -m -u 1000 -U -s /bin/sh -d /node-dev node-dev && \
mkdir -p /chain-data /node-dev/.local/share && \
chown -R node-dev:node-dev /chain-data && \
ln -s /chain-data /node-dev/.local/share/node-template && \
# unclutter and minimize the attack surface
rm -rf /usr/bin /usr/sbin && \
# check if executable works in this container
/usr/local/bin/node-template --version
USER node-dev
EXPOSE 30333 9944 9615
VOLUME ["/chain-data"]
ENTRYPOINT ["/usr/local/bin/node-template"]