-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
56 lines (41 loc) · 1.3 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
FROM python:3.8.3-slim
LABEL maintainer="tac@tac42.net"
# o-namazu is data collector that traverse specified directories.
RUN mkdir /o-namazu
ADD README.md onamazu.py requirements.txt /o-namazu/
ADD onamazu /o-namazu/onamazu
WORKDIR /o-namazu
RUN apt-get update && apt-get -y upgrade \
&& apt-get install -y --no-install-recommends gcc g++ musl-dev \
&& pip install -r requirements.txt \
&& apt-get clean \
&& apt-get autoclean \
&& apt-get autoremove \
&& rm -rf /tmp/* /var/tmp/* \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /var/lib/apt/lists/*
################
# Environments #
################
# Target directory to observe by o-namazu
ENV TARGET_DIR /data
# Log level [DEBUG, INFO, WARN, ERROR]
ENV LOG_LEVEL INFO
# Log format by 'logging' package
ENV LOG_FORMAT "[%(levelname)s] %(asctime)s | %(pathname)s(L%(lineno)s) | %(message)s"
# Log file name
ENV LOG_FILE onamazu.log
# Count of file files kept
ENV LOG_FILE_COUNT 1000
# Size of each log file
ENV LOG_FILE_SIZE 1000000
RUN mkdir /logs
VOLUME /logs
RUN mkdir /data
VOLUME /data
ENTRYPOINT python ./onamazu.py ${TARGET_DIR} \
--log-level ${LOG_LEVEL} \
--log-file /logs/`cat /etc/hostname`/${LOG_FILE} \
--log-format "${LOG_FORMAT}" \
--log-file-count ${LOG_FILE_COUNT}\
--log-file-size ${LOG_FILE_SIZE}