forked from hummingbot/hummingbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
76 lines (57 loc) · 2.13 KB
/
Dockerfile
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
# Set the base image
FROM continuumio/miniconda3:latest AS builder
# Install system dependencies
RUN apt-get update && \
apt-get install -y sudo libusb-1.0 gcc g++ python3-dev && \
rm -rf /var/lib/apt/lists/*
WORKDIR /home/hummingbot
# Create conda environment
COPY setup/environment.yml /tmp/environment.yml
RUN conda env create -f /tmp/environment.yml && \
conda clean -afy && \
rm /tmp/environment.yml
# Copy remaining files
COPY bin/ bin/
COPY hummingbot/ hummingbot/
COPY scripts/ scripts/
COPY scripts/ scripts-copy/
COPY setup.py .
COPY LICENSE .
COPY README.md .
COPY DATA_COLLECTION.md .
# activate hummingbot env when entering the CT
SHELL [ "/bin/bash", "-lc" ]
RUN echo "conda activate hummingbot" >> ~/.bashrc
RUN python3 setup.py build_ext --inplace -j 8 && \
rm -rf build/ && \
find . -type f -name "*.cpp" -delete
# Build final image using artifacts from builder
FROM continuumio/miniconda3:latest AS release
# Dockerfile author / maintainer
LABEL maintainer="Fede Cardoso @dardonacci <[email protected]>"
# Build arguments
ARG BRANCH=""
ARG COMMIT=""
ARG BUILD_DATE=""
LABEL branch=${BRANCH}
LABEL commit=${COMMIT}
LABEL date=${BUILD_DATE}
# Set ENV variables
ENV COMMIT_SHA=${COMMIT}
ENV COMMIT_BRANCH=${BRANCH}
ENV BUILD_DATE=${DATE}
ENV INSTALLATION_TYPE=docker
# Install system dependencies
RUN apt-get update && \
apt-get install -y sudo libusb-1.0 && \
rm -rf /var/lib/apt/lists/*
# Create mount points
RUN mkdir -p /home/hummingbot/conf /home/hummingbot/conf/connectors /home/hummingbot/conf/strategies /home/hummingbot/logs /home/hummingbot/data /home/hummingbot/certs /home/hummingbot/scripts
WORKDIR /home/hummingbot
# Copy all build artifacts from builder image
COPY --from=builder /opt/conda/ /opt/conda/
COPY --from=builder /home/ /home/
# Setting bash as default shell because we have .bashrc with customized PATH (setting SHELL affects RUN, CMD and ENTRYPOINT, but not manual commands e.g. `docker run image COMMAND`!)
SHELL [ "/bin/bash", "-lc" ]
# Set the default command to run when starting the container
CMD conda activate hummingbot && ./bin/hummingbot_quickstart.py 2>> ./logs/errors.log