Merge pull request #4843 from docbobo/arm64-support
Docker support for arm64
This commit is contained in:
		| @@ -8,10 +8,13 @@ if [ ! -f "${INSTALL_LOC}/lib/libta_lib.a" ]; then | ||||
|   tar zxvf ta-lib-0.4.0-src.tar.gz | ||||
|   cd ta-lib \ | ||||
|   && sed -i.bak "s|0.00000001|0.000000000000000001 |g" src/ta_func/ta_utility.h \ | ||||
|   && curl 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD' -o config.guess \ | ||||
|   && curl 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD' -o config.sub \ | ||||
|   && ./configure --prefix=${INSTALL_LOC}/ \ | ||||
|   && make \ | ||||
|   && make -j$(nproc) \ | ||||
|   && which sudo && sudo make install || make install \ | ||||
|   && cd .. | ||||
| else | ||||
|   echo "TA-lib already installed, skipping installation" | ||||
| fi | ||||
| #  && sed -i.bak "s|0.00000001|0.000000000000000001 |g" src/ta_func/ta_utility.h \ | ||||
|   | ||||
							
								
								
									
										58
									
								
								docker/Dockerfile.aarch64
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								docker/Dockerfile.aarch64
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,58 @@ | ||||
| FROM --platform=linux/arm64/v8 python:3.9.4-slim-buster as base | ||||
|  | ||||
| # Setup env | ||||
| ENV LANG C.UTF-8 | ||||
| ENV LC_ALL C.UTF-8 | ||||
| ENV PYTHONDONTWRITEBYTECODE 1 | ||||
| ENV PYTHONFAULTHANDLER 1 | ||||
| ENV PATH=/home/ftuser/.local/bin:$PATH | ||||
| ENV FT_APP_ENV="docker" | ||||
|  | ||||
| # Prepare environment | ||||
| RUN mkdir /freqtrade \ | ||||
|   && apt-get update \ | ||||
|   && apt-get -y install libatlas3-base curl sqlite3 libhdf5-serial-dev sudo \ | ||||
|   && apt-get clean \ | ||||
|   && useradd -u 1000 -G sudo -U -m ftuser \ | ||||
|   && chown ftuser:ftuser /freqtrade \ | ||||
|   # Allow sudoers | ||||
|   && echo "ftuser ALL=(ALL) NOPASSWD: /bin/chown" >> /etc/sudoers | ||||
|  | ||||
| WORKDIR /freqtrade | ||||
|  | ||||
| # Install dependencies | ||||
| FROM base as python-deps | ||||
| RUN apt-get update \ | ||||
|   && apt-get -y install curl build-essential libssl-dev git libffi-dev libgfortran5 pkg-config cmake gcc \ | ||||
|   && apt-get clean \ | ||||
|   && pip install --upgrade pip | ||||
|  | ||||
| # Install TA-lib | ||||
| COPY build_helpers/* /tmp/ | ||||
| RUN cd /tmp && /tmp/install_ta-lib.sh && rm -r /tmp/*ta-lib* | ||||
| ENV LD_LIBRARY_PATH /usr/local/lib | ||||
|  | ||||
| # Install dependencies | ||||
| COPY --chown=ftuser:ftuser requirements.txt requirements-hyperopt.txt /freqtrade/ | ||||
| USER ftuser | ||||
| RUN  pip install --user --no-cache-dir numpy \ | ||||
|   && pip install --user --no-cache-dir -r requirements-hyperopt.txt | ||||
|  | ||||
| # Copy dependencies to runtime-image | ||||
| FROM base as runtime-image | ||||
| COPY --from=python-deps /usr/local/lib /usr/local/lib | ||||
| ENV LD_LIBRARY_PATH /usr/local/lib | ||||
|  | ||||
| COPY --from=python-deps --chown=ftuser:ftuser /home/ftuser/.local /home/ftuser/.local | ||||
|  | ||||
| USER ftuser | ||||
| # Install and execute | ||||
| COPY --chown=ftuser:ftuser . /freqtrade/ | ||||
|  | ||||
| RUN pip install -e . --user --no-cache-dir \ | ||||
|   && mkdir /freqtrade/user_data/ \ | ||||
|   && freqtrade install-ui | ||||
|  | ||||
| ENTRYPOINT ["freqtrade"] | ||||
| # Default to trade mode | ||||
| CMD [ "trade" ] | ||||
| @@ -48,6 +48,8 @@ Create a new directory and place the [docker-compose file](https://raw.githubuse | ||||
|     # Download the docker-compose file from the repository | ||||
|     curl https://raw.githubusercontent.com/freqtrade/freqtrade/stable/docker-compose.yml -o docker-compose.yml | ||||
|  | ||||
|     # Edit the compose file to use an image named `*_pi` (stable_pi or develop_pi) | ||||
|  | ||||
|     # Pull the freqtrade image | ||||
|     docker-compose pull | ||||
|  | ||||
| @@ -65,6 +67,30 @@ Create a new directory and place the [docker-compose file](https://raw.githubuse | ||||
|         # image: freqtradeorg/freqtrade:develop_pi | ||||
|         ``` | ||||
|  | ||||
| === "ARM64 (Mac M1)" | ||||
|     Make sure that your docker installation is running in native mode | ||||
|  | ||||
|     ``` bash | ||||
|     mkdir ft_userdata | ||||
|     cd ft_userdata/ | ||||
|     # Download the docker-compose file from the repository | ||||
|     curl https://raw.githubusercontent.com/freqtrade/freqtrade/stable/docker-compose.yml -o docker-compose.yml | ||||
|  | ||||
|     # Edit the compose file, uncomment the "build" step and use "./docker/Dockerfile.aarch64" | ||||
|     # Also, change the image name to something of your liking | ||||
|  | ||||
|     # Build the freqtrade image (this may take a while) | ||||
|     docker-compose build | ||||
|  | ||||
|     # Create user directory structure | ||||
|     docker-compose run --rm freqtrade create-userdir --userdir user_data | ||||
|  | ||||
|     # Create configuration - Requires answering interactive questions | ||||
|     docker-compose run --rm freqtrade new-config --config user_data/config.json | ||||
|     ``` | ||||
|     !!! Warning | ||||
|         You should not use the default image name - this can result in conflicting names between local and dockerhub and should therefore be avoided. | ||||
|  | ||||
| The above snippet creates a new directory called `ft_userdata`, downloads the latest compose file and pulls the freqtrade image. | ||||
| The last 2 steps in the snippet create the directory with `user_data`, as well as (interactively) the default configuration based on your selections. | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user