-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
57 lines (48 loc) · 2.03 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
FROM python:3.11.2-slim-bullseye
RUN apt-get update && apt-get install -y --no-install-recommends \
cron \
tzdata \
postgresql-client \
locales \
gettext \
iputils-ping \
net-tools \
dnsutils \
curl \
wget\
locales &&\
apt-get autoremove -y &&\
apt-get clean -y && \
rm -rf /var/lib/apt/lists/*
WORKDIR /sige-slave
COPY requirements.txt .
RUN pip install --upgrade pip \
&& pip install --no-cache-dir -r requirements.txt
COPY . /sige-slave
# ----------------------------< locale and timezone >-------------------------------------
RUN sed -i 's/# pt_BR.UTF-8 UTF-8/pt_BR.UTF-8 UTF-8/' /etc/locale.gen \
&& locale-gen pt_BR.UTF-8 \
&& dpkg-reconfigure --frontend noninteractive locales \
&& ln -snf /usr/share/zoneinfo/America/Sao_Paulo /etc/localtime \
&& echo "America/Sao_Paulo" > /etc/timezone \
&& dpkg-reconfigure -f noninteractive tzdata
# --------------------------------< logrotate >-------------------------------------------
RUN mkdir -p /etc/logrotate.d && \
touch /sige-slave/logs/cron_output.log && \
echo "/sige-slave/logs/cron_output.log {" > /etc/logrotate.d/sige_slave && \
echo " size 100M" >> /etc/logrotate.d/sige_slave && \
echo " daily" >> /etc/logrotate.d/sige_slave && \
echo " missingok" >> /etc/logrotate.d/sige_slave && \
echo " rotate 7" >> /etc/logrotate.d/sige_slave && \
echo " compress" >> /etc/logrotate.d/sige_slave && \
echo " delaycompress" >> /etc/logrotate.d/sige_slave && \
echo " notifempty" >> /etc/logrotate.d/sige_slave && \
echo " create 0644 root root" >> /etc/logrotate.d/sige_slave && \
echo "}" >> /etc/logrotate.d/sige_slave
# ----------------------------------< cron >-----------------------------------------------
RUN wget https://cronitor.io/dl/linux_amd64.tar.gz \
&& tar xvf linux\_amd64.tar.gz -C /usr/local/bin/
COPY crons/cronjob /etc/cron.d/sige-cron
RUN chmod 0644 /etc/cron.d/sige-cron && \
/usr/bin/crontab /etc/cron.d/sige-cron
CMD ["/sige-slave/scripts/start.sh"]