-
Notifications
You must be signed in to change notification settings - Fork 0
/
DockerfileDatabaseTimeMachine
executable file
·67 lines (49 loc) · 1.92 KB
/
DockerfileDatabaseTimeMachine
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
FROM debian:bookworm-20240311
ENV TZ=Europe/Paris
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN if [ -f ./deploy_configuration/.env_proxy ]; then \
# Si le fichier source existe, copiez-le
COPY ./deploy_configuration/.env_proxy /; \
fi
COPY ./deploy_configuration/proxy.sh /
RUN chmod +x /proxy.sh
RUN sh /proxy.sh
ARG HTTP_PROXY_CI
ENV http_proxy=$HTTP_PROXY_CI
ENV https_proxy=$HTTP_PROXY_CI
ENV HTTP_PROXY=$HTTP_PROXY_CI
ENV HTTPS_PROXY=$HTTP_PROXY_CI
# Vérifiez si la variable d'environnement http_proxy est définie
RUN if [ -n "$http_proxy" ]; then \
# Si elle est définie, exécutez les commandes pour configurer le proxy
touch /etc/apt/apt.conf.d/05proxy; \
echo 'Acquire::HTTP::Proxy "'$http_proxy'";' >> /etc/apt/apt.conf.d/05proxy; \
echo 'Acquire::HTTPS::Prox "'$http_proxy'";' >> /etc/apt/apt.conf.d/05proxy; \
echo 'Acquire::ftp::Proxy "'$http_proxy'";' >> /etc/apt/apt.conf.d/05proxy; \
echo "Proxy configuré dans le système de packages avec la valeur $http_proxy" && true; \
fi
RUN mkdir /timemachine
RUN chmod 755 /timemachine
RUN apt-get update && apt-get install -y cron postgresql-client
RUN apt-get install -y python3-full python3-pip
RUN apt-get install -y python3-boto3
RUN apt-get install -y jq
COPY ./deploy_configuration/time-machine/upload-dump-database-s3.py /
RUN chmod u+x /upload-dump-database-s3.py
ADD ./deploy_configuration/time-machine/timemachine.sh /
RUN chmod +x /timemachine.sh
RUN apt-get update
RUN apt-get install -y curl
RUN curl https://dl.min.io/client/mc/release/linux-arm64/mc \
--create-dirs \
-o ~/minio-binaries/mc
RUN apt-get install -y s3cmd
# Toutes les 6 heures
# RUN echo "0 */6 * * * /etc/cron.daily/timemachine.sh" > /etc/crontab
# désormais injecté comme deployment pour la souplesse
ENV HTTP_PROXY ""
ENV HTTPS_PROXY ""
ENV http_proxy ""
ENV https_proxy ""
RUN rm -f /etc/apt/apt.conf.d/05proxy
CMD ["cron", "-f"]