forked from Chia-Network/drplotter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3341ced
commit 4fbe681
Showing
6 changed files
with
206 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: Docker | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
tag: | ||
description: "Release tag of upstream drplotter repo" | ||
required: true | ||
type: string | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build-and-push-images: | ||
name: Build and push images | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- final-build-stage: plotter | ||
- final-build-stage: solver | ||
- final-build-stage: server | ||
- final-build-stage: harvester | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Extract metadata for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
flavor: | | ||
latest=true | ||
suffix=-${{ matrix.final-build-stage }},onlatest=true | ||
tags: | | ||
type=raw,value=${{ inputs.tag }} | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login to the container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
build-args: GITHUB_RELEASE_TAG=${{ inputs.tag }} | ||
target: ${{ matrix.final-build-stage }} | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
FROM debian:12-slim AS builder | ||
ARG DEBIAN_FRONTEND=noninteractive | ||
RUN apt-get update && apt-get install -y xz-utils curl | ||
WORKDIR / | ||
ARG GITHUB_RELEASE_TAG | ||
RUN GITHUB_RELEASE_TAG=${GITHUB_RELEASE_TAG%-*} \ | ||
&& curl -L https://github.com/drnick23/drplotter/releases/download/${GITHUB_RELEASE_TAG}/drplotter-${GITHUB_RELEASE_TAG}-x86-64.tar.gz --output drplotter.tar.gz \ | ||
&& tar -xf drplotter.tar.gz \ | ||
&& mv drplotter-${GITHUB_RELEASE_TAG}-x86-64 drplotter | ||
|
||
|
||
FROM mikefarah/yq:4 AS yq | ||
|
||
|
||
FROM debian:12-slim AS base | ||
ARG DEBIAN_FRONTEND=noninteractive | ||
RUN apt-get update && apt-get install --no-install-recommends -y \ | ||
tzdata \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
WORKDIR /app | ||
|
||
|
||
FROM base AS compute-base | ||
RUN apt-get update && apt-get install --no-install-recommends -y \ | ||
ocl-icd-libopencl1 \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
RUN mkdir -p /etc/OpenCL/vendors && \ | ||
echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd | ||
ENV NVIDIA_VISIBLE_DEVICES all | ||
ENV NVIDIA_DRIVER_CAPABILITIES compute,utility | ||
|
||
|
||
FROM compute-base AS plotter | ||
COPY --from=builder /drplotter/drplotter . | ||
ENTRYPOINT ["./drplotter"] | ||
|
||
|
||
FROM compute-base AS solver | ||
COPY --from=builder /drplotter/drsolver . | ||
ENTRYPOINT ["./drsolver"] | ||
|
||
|
||
FROM base AS server | ||
COPY --from=builder /drplotter/drserver . | ||
ENTRYPOINT ["./drserver"] | ||
|
||
|
||
FROM base AS harvester | ||
COPY --from=yq /usr/bin/yq /usr/bin/yq | ||
COPY --from=builder /drplotter/drharvester . | ||
COPY harvester-docker-entrypoint.sh ./docker-entrypoint.sh | ||
COPY harvester-docker-start.sh ./docker-start.sh | ||
ENV CHIA_ROOT="/root/.chia/mainnet" | ||
ENTRYPOINT ["./docker-entrypoint.sh"] | ||
CMD ["./docker-start.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
version: '3' | ||
services: | ||
plotter: | ||
image: ghcr.io/foxypool/drplotter:latest-plotter | ||
restart: unless-stopped | ||
runtime: nvidia | ||
volumes: | ||
- /path/to/plots:/plots | ||
# environment: | ||
# ## GPU Specific Options | ||
# NVIDIA_VISIBLE_DEVICES: 0,3 | ||
command: plot -f <your_farmer_key> -c <your_pool_contract_address> -d /plots/ --compression <eco3x or pro4x> | ||
server: | ||
image: ghcr.io/foxypool/drplotter:latest-server | ||
restart: unless-stopped | ||
ports: | ||
- "8080:8080" | ||
solver: | ||
image: ghcr.io/foxypool/drplotter:latest-solver | ||
restart: unless-stopped | ||
runtime: nvidia | ||
# environment: | ||
# ## Remote drsolver | ||
# DRPLOTTER_CLIENT_TOKEN: your_unique_48_character_token_here | ||
# ## Local drserver | ||
# DRSERVER_IP_ADDRESS: your_drserver_ip_address:port | ||
# ## GPU Specific Options | ||
# NVIDIA_VISIBLE_DEVICES: 0,3 | ||
harvester: | ||
image: ghcr.io/foxypool/drplotter:latest-harvester | ||
restart: unless-stopped | ||
volumes: | ||
- /path/to/.chia:/root/.chia/mainnet | ||
- /path/to/plots:/plots | ||
# - /path/to/ssl/ca:/path/in/container | ||
environment: | ||
CHIA_LOG_LEVEL: 'INFO' | ||
CHIA_PLOTS: /plots | ||
CHIA_FARMER_ADDRESS: your_farmer_ip_or_hostname_here | ||
CHIA_FARMER_PORT: 8447 | ||
# CHIA_HOSTNAME: 127.0.0.1 | ||
# TZ: 'UTC' | ||
# ## Only set CHIA_CA once on init, remove afterward | ||
# CHIA_CA: /path/in/container | ||
# ## Remote drsolver | ||
# DRPLOTTER_CLIENT_TOKEN: your_unique_48_character_token_here | ||
# ## Local drserver | ||
# DRSERVER_IP_ADDRESS: your_drserver_ip_address:port |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
|
||
if [[ -n "${TZ}" ]]; then | ||
echo "Timezone set to ${TZ}" | ||
fi | ||
|
||
./drchia init --fix-ssl-permissions | ||
|
||
if [[ -n ${CHIA_HOSTNAME} ]]; then | ||
yq -i '.self_hostname = env(CHIA_HOSTNAME)' "$CHIA_ROOT/config/config.yaml" | ||
else | ||
yq -i '.self_hostname = "127.0.0.1"' "$CHIA_ROOT/config/config.yaml" | ||
fi | ||
|
||
if [[ -n "${CHIA_LOG_LEVEL}" ]]; then | ||
./drchia configure --log-level "${CHIA_LOG_LEVEL}" | ||
fi | ||
|
||
for p in ${CHIA_PLOTS//:/ }; do | ||
mkdir -p "${p}" | ||
if [[ ! $(ls -A "$p") ]]; then | ||
echo "Plots directory '${p}' appears to be empty, try mounting a plot directory with the docker -v command" | ||
fi | ||
./drchia plots add -d "${p}" | ||
done | ||
|
||
if [[ -n ${CHIA_FARMER_ADDRESS} && -n ${CHIA_FARMER_PORT} && -n ${CHIA_CA} ]]; then | ||
./drchia init -c "${CHIA_CA}" && ./drchia configure --set-farmer-peer "${CHIA_FARMER_ADDRESS}:${CHIA_FARMER_PORT}" | ||
fi | ||
|
||
exec "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
./drchia start harvester | ||
|
||
trap "echo Shutting down ...; ./drchia stop all -d; exit 0" SIGINT SIGTERM | ||
|
||
tail -F "$CHIA_ROOT/log/debug.log" |