-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathContainerfile
executable file
·63 lines (49 loc) · 2.24 KB
/
Containerfile
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
58
59
60
61
62
63
########################################################################################################################
# Configuration
########################################################################################################################
# Core Config
ARG p2pool_version=4.1.1
# Ports:
# 3333: Stratum server (port used for miners to communicate with p2pool)
# 37888: p2pool-mini side chain peer communications
# 37889: p2pool side chain peer communications
ARG ports="3333 37888 37889"
# Defaults
ARG build_dir=/tmp/build
ARG license_dir=$build_dir/licenses
ARG dist_dir=$build_dir/dist
########################################################################################################################
# Build Image
########################################################################################################################
FROM cgr.dev/chainguard/wolfi-base:latest as build
ARG build_dir license_dir dist_dir p2pool_version
ARG base_archive_url="https://github.com/SChernykh/p2pool/releases/download/v${p2pool_version}"
# Copy assets
WORKDIR $build_dir
COPY SChernykh.asc .
COPY LICENSE $license_dir/
COPY download.bash .
# Setup environment variables for script
ENV BASE_ARCHIVE_URL="$base_archive_url"
ENV DIST_DIR="$dist_dir"
ENV P2POOL_VERSION="$p2pool_version"
# Install build packages
RUN apk add --no-cache bash gpg gpg-agent wget && \
./download.bash && \
cp archive/LICENSE "${license_dir}/P2POOL_LICENSE"
########################################################################################################################
# Final image
########################################################################################################################
FROM cgr.dev/chainguard/glibc-dynamic:latest as final
ARG dist_dir license_dir ports
# Install binaries
COPY --from=build $dist_dir /usr/local/bin
COPY --from=build $license_dir /usr/local/share/licenses/p2pool
# Setup a volume for persistent data
VOLUME /var/lib/p2pool
# Expose ports
EXPOSE $ports
# Set working directory to /home/nonroot since p2pool will write the peer list to the working directory
WORKDIR /home/nonroot
# Run entrypoint
ENTRYPOINT ["/usr/local/bin/p2pool", "--data-api", "/var/lib/p2pool"]