forked from nimiq/core-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile_git
46 lines (36 loc) · 1.48 KB
/
Dockerfile_git
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
FROM node:9-stretch
# Build from master branch by default.
# One can override this using --build-arg when building the docker
# image from this file.
ARG BRANCH=master
# Install dependencies
RUN apt-get update && apt-get -y upgrade
RUN apt-get install -y build-essential git-core
# We're going to execute nimiq in the context of its own user, what else?
ENV USER=nimiq
RUN useradd -m ${USER}
# Create a working directory for the nimiq process
ENV DATA_PATH=/nimiq
RUN mkdir ${DATA_PATH} && chown ${USER}:root ${DATA_PATH}
WORKDIR ${DATA_PATH}
# Build environment as non-root user
USER ${USER}
# Clone
RUN git clone --branch ${BRANCH} https://github.com/nimiq-network/core.git core
# Build
RUN cd core && yarn
# Remove build tools
USER root
RUN apt-get remove -y build-essential
# Execute client as non-root user
USER ${USER}
# Just execute the nimiq process. One can customize the created container easily
# to one's needs by (at least) the following options:
# - supply your own arguments to the entrypoint while creating the container, e.g.
# docker run nimiq/nodejs-client --miner
# - just bind mount your own nimiq.conf to the container at /etc/nimiq/nimiq.conf
# then you can just create the container like (assuming the config is in the
# current working directory)
# docker run nimiq/nodejs-client -v $(pwd)/nimiq.conf:/etc/nimiq/nimiq.conf --config=/etc/nimiq.conf
# (- of course, you can combine and modify these options suitable to your needs)
ENTRYPOINT [ "./core/clients/nodejs/nimiq" ]