-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
40 lines (33 loc) · 1.27 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
FROM ubuntu:latest
# Update apt-get list, install Python, and install other appropriate dependencies
RUN apt-get update
RUN apt-get install -y python3 python3-distutils python3-pip python3-apt cron
RUN pip3 install pyserial PyYAML
# Install timezone dependencies and establish docker container timezone
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install tzdata
ENV TZ=America/Phoenix
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# Copy necessary files to local docker container environment
ADD crontab /etc/cron.d/simple-cron
ADD utils.py /utils.py
ADD config.yaml /config.yaml
ADD sdi_12_data_collector.py /sdi_12_data_collector.py
ADD sdi_12_data_collector.sh /sdi_12_data_collector.sh
ADD sdi_12_initialization.py /sdi_12_initialization.py
# Create necessary files and directories inside docker container
RUN touch /var/log/cron.log
RUN mkdir -p /Data
RUN mkdir -p /Data/logs
# Establish correct permissions for files
RUN chmod +x /etc/cron.d/simple-cron
RUN chmod +x /sdi_12_data_collector.py
RUN chmod +x /sdi_12_data_collector.sh
RUN chmod +x /utils.py
RUN chmod 774 /config.yaml
# Running crontab
RUN crontab /etc/cron.d/simple-cron
# Run the command on container startup
CMD cron \
&& sleep 5 \
&& ./sdi_12_data_collector.sh \
&& bash