-
Notifications
You must be signed in to change notification settings - Fork 9
/
sv1-public-pool.dockerfile
57 lines (45 loc) · 1.65 KB
/
sv1-public-pool.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
53
54
55
56
57
############################
# Docker build environment #
############################
FROM node:18.16.1-bookworm-slim AS build
# Upgrade all packages and install dependencies
RUN apt-get update && \
apt-get upgrade -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
python3 \
build-essential \
cmake \
git \
ca-certificates \
iproute2 \
iputils-ping \
curl \
&& apt clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Clone the repository
RUN git clone https://github.com/benjamin-wilson/public-pool.git
WORKDIR /public-pool
# Build Public Pool using NPM
RUN npm i && npm run build
############################
# Docker final environment #
############################
FROM node:18.16.1-bookworm-slim
# Install necessary packages in the final image
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
iproute2 \
iputils-ping \
curl \
&& apt clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Expose ports for Stratum and Bitcoin RPC
EXPOSE 3333 3334 8332 48332
# Set the working directory
WORKDIR /public-pool
# Copy built binaries into the final image
COPY --from=build /public-pool .
# Copy the monitoring script into the container
COPY ./pools-latency-calculator/monitor_and_apply_latency.sh /usr/local/bin/monitor_and_apply_latency.sh
# Make the script executable
RUN chmod +x /usr/local/bin/monitor_and_apply_latency.sh
# Run the monitoring script in the background and start the main application
CMD ["/bin/bash", "-c", "/usr/local/bin/monitor_and_apply_latency.sh 10.5.0.19 2 & exec /usr/local/bin/node dist/main"]