Closed tboy1337 closed 3 weeks ago
It's not complete yet, If I have time I will create a docker file.
Heres a better version if you want it @masterking32.
# Create a .env file in the same directory as docker-compose.yml to set environment variables like MCF_PATH and TZ if you want to customize them otherwise defaults will be used e.g.:
# MCFB_PATH=C:\path\to\your\MCFB
# TZ=Your/Timezone
# For Synology NAS you need to create the directory path manually in your system because docker cannot create folders in Synology.
services:
mcfb:
build:
context: .
dockerfile: |
FROM python:3.12.0-slim
RUN apt-get update && \
apt-get install -y --no-install-recommends git && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
useradd -m mcfbuser
USER mcfbuser
WORKDIR /mcfb
COPY --chown=mcfbuser:mcfbuser entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
image: mcfb:latest
container_name: MasterCryptoFarmBot
restart: unless-stopped
volumes:
- ${MCFB_PATH:-~/.MCFB/container}:/mcfb
environment:
- PYTHONUNBUFFERED=1
- TZ=${TZ:-Europe/London}
ports:
- "1337:1337"
init: true
network_mode: bridge
healthcheck:
test: ["CMD-SHELL", "test -f /mcfb/main.py || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
configs:
entrypoint_script:
content: |
#!/bin/bash
set -e
if [ ! -f main.py ]; then
echo 'Cloning repository ...'
git clone https://github.com/masterking32/MasterCryptoFarmBot.git ./
fi
git config --global --add safe.directory /mcfb
if [ ! -f config.py ]; then
echo 'Copying config from sample ...'
cp config.py.sample config.py
fi
if [ -f start_linux.sh ]; then
echo 'Launching ...'
bash start_linux.sh
else
echo 'start_linux.sh not found. Exiting.'
exit 1
fi
Created by @Fy0urM and tested by himself, myself and another user on windows, linux and a Synology NAS. I'm using it currently with no issues.