# Parent image
FROM ubuntu

# Install required libraries
RUN apt-get update && apt-get install -y libssl-dev

# Set work directory
WORKDIR /app

# COPY executable file to work directory
COPY ./bin/tdengined .

# Copy configuration file to /etc/taos
COPY ./cfg/tdengine.cfg /etc/tdengine/

# Volume to communicate with host machine
#        data file           log file       config file
VOLUME ["/var/lib/tdengine/", "/var/log/tdengine/", "/etc/tdengine/"]

# Port to expose to outside of the world.
EXPOSE 6100 6120 6140 6160 6180 6200 6220 6240 6260 6280 6290 6300 8080

# Command to run
ENTRYPOINT ["/app/tdengined"]

# To build the image
# docker build -t mnode_img -f Dockerfile.mnode .

# To run mnode
# docker run --rm -it --name mnode \
#     -p 6100:6100 -p 6120:6120 -p 6220:6220 -p 6260:6260 -p 6280:6280 \
#     --mount source=taos_data,target=/var/lib/taos/ \
#     --mount source=taos_log,target=/var/log/taos/  \
#     --mount type=bind,source=/home/hzcheng/Documents/TAOS/taosdata/cfg/,target=/etc/taos/ \
#     --network isolated_nw --ip 172.25.0.10 \
#     mnode_img
#
