forked from Appdynamics/jekyll-rtd-theme
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
139 lines (120 loc) · 4.35 KB
/
Dockerfile
File metadata and controls
139 lines (120 loc) · 4.35 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# Use the latest PostgreSQL image as the base
# FROM python:3.13.8-slim-bookworm AS base
#FROM postgres:latest as base
# Use 15-bookworm (Python 3.11 to supports Tensorflow)
FROM postgres:15-bookworm AS base
EXPOSE 5432 8080 8081 8082
WORKDIR /home/runner
#WORKDIR /freqtrade
# Setup env
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONFAULTHANDLER=1
ENV FT_APP_ENV="docker"
ENV POSTGRES_DB postgres
ENV POSTGRES_USER postgres
ENV POSTGRES_PASSWORD postgres
ENV DEBIAN_FRONTEND=noninteractive
# Runtime Dependencies
# Ref: https://github.com/freqtrade/freqtrade/blob/develop/Dockerfile
RUN apt-get update -qq > /dev/null 2>&1 && apt-get install -y -qq \
bc \
ca-certificates \
cron \
curl \
earlyoom \
git \
jq \
libatlas3-base \
libhdf5-serial-dev \
libgomp1 \
nano \
python3 \
python3-pip \
python3-venv \
python3-dev \
sqlite3 \
subversion \
sudo \
supervisor \
unzip \
wget \
--no-install-recommends > /dev/null 2>&1 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
#useradd -u 1000 -G sudo -U -m -s /bin/bash ftuser && \
#chown ftuser:ftuser /freqtrade && \
#echo "ftuser ALL=(ALL) NOPASSWD: /bin/chown" >> /etc/sudoers
# Instal build-image
FROM base as python-deps
# Build Dependencies
# Ref: https://github.com/freqtrade/freqtrade/blob/develop/Dockerfile
RUN apt-get update -qq > /dev/null 2>&1 && apt-get install -y -qq \
build-essential \
cmake \
freeglut3-dev \
gcc \
git \
libffi-dev \
libgfortran5 \
libssl-dev \
libxext-dev \
libxi-dev \
libxmu-dev \
libxmu-headers \
pkg-config \
--no-install-recommends > /dev/null 2>&1 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Install TA-Lib and Freqtrade
ADD user_data/build_helpers/ /tmp/
RUN set -ex \
&& cd /tmp \
&& ./install_ta-lib.sh > /dev/null 2>&1 \
&& rm -rf /tmp/* /tmp/.[!.]* /tmp/..?* \
&& mkdir -p /tmp && chmod 1777 /tmp \
&& curl -s https://api.github.com/repos/freqtrade/freqtrade/contents?ref=2025.10 \
| jq -r '.[] | select(.name | test("^requirements(-.*)?\\.txt$")) | .path' \
| xargs -I{} curl -sO "https://raw.githubusercontent.com/freqtrade/freqtrade/2025.10/{}" \
&& python3 -m venv /home/runner/venv \
&& . /home/runner/venv/bin/activate \
&& pip install -qq --upgrade pip wheel \
&& pip install -qq --no-cache-dir -r /tmp/requirements-plot.txt \
&& pip install -qq --no-cache-dir -r /tmp/requirements-freqai-rl.txt \
&& pip install -qq --no-cache-dir ta "numpy<3.0" "aiodns<3.0" "freqtrade==2025.10" "tensorflow-cpu==2.20.0" \
&& pip install -qq --pre iree-base-compiler iree-base-runtime iree-tools-tf -f https://iree.dev/pip-release-links.html \
&& rm -rf /tmp/* /root/.cache/pip /var/lib/apt/lists/* \
&& mkdir -p /tmp && chmod 1777 /tmp
# Final runtime-image
FROM base as runtime-image
COPY --from=python-deps /home/runner/venv /home/runner/venv
COPY --from=python-deps /usr/local/lib /usr/local/lib
ENV PATH=/home/runner/venv/bin:$PATH
ENV LD_LIBRARY_PATH=/usr/local/lib
# Use custom entrypoint to start both PostgreSQL and freqtrade
ADD user_data /home/runner/user_data
ADD user_data/ft_client/*.conf /etc/supervisor/
ADD user_data/data/setup.sql /docker-entrypoint-initdb.d/
ADD user_data/ft_client/test_client/freqtrade.sh /freqtrade.sh
ADD user_data/ft_client/test_client/entrypoint.sh /entrypoint.sh
ADD user_data/config_examples/config_basic.example.json /home/runner/user_data/config.json
# Start PostgreSQL with custom configuration
#COPY conf/pg_hba.conf /etc/postgresql/pg_hba.conf
#COPY conf/postgresql.conf /etc/postgresql/postgresql.conf
#COPY conf/docker-entrypoint-initdb.d/* /docker-entrypoint-initdb.d/
#RUN chmod a+r /docker-entrypoint-initdb.d/*
#RUN chown postgres:postgres /docker-entrypoint-initdb.d/*
#CMD ["postgres", "-c", "config_file=/etc/postgresql/postgresql.conf"]
# Install pgvector and make sure the extension can be loaded
#RUN wget https://github.com/pgvector/pgvector/archive/refs/tags/v0.2.1.tar.gz
#RUN tar -xzf v0.2.1.tar.gz && cd pgvector-0.2.1 && make && make install
#RUN echo "shared_preload_libraries = 'vector'" >> /etc/postgresql/postgresql.conf
# Execute
#USER ftuser
#COPY --chown=ftuser:ftuser . /freqtrade/
#RUN pip install -e . --user --no-cache-dir \
#&& mkdir /freqtrade/user_data/ \
#&& freqtrade install-ui
# Run entrypoint
ENTRYPOINT ["/entrypoint.sh"]