-
Notifications
You must be signed in to change notification settings - Fork 7
/
Dockerfile-cleanup
35 lines (27 loc) · 1.1 KB
/
Dockerfile-cleanup
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
FROM alpine:latest
RUN apk add --no-cache logrotate
RUN mkdir -p /var/vision/log
RUN mkdir -p /var/vision/static
RUN mkdir -p /var/vision/script
# Configure logrotate hourly
COPY docker/logrotate.conf /var/vision/script/logrotate.conf
COPY docker/logrotate-cron.sh /var/vision/script/logrotate-cron.sh
RUN chmod 400 /var/vision/script/logrotate.conf
RUN crontab -l | { cat; echo "0 * * * * sh /var/vision/script/logrotate-cron.sh"; } | crontab -
# Configure job to clean static folder
COPY docker/clean-static-cron.sh /var/vision/script/clean-static-cron.sh
RUN crontab -l | { cat; echo "*/10 * * * * sh /var/vision/script/clean-static-cron.sh"; } | crontab -
ARG GIT_BRANCH
ARG GIT_COMMIT
ARG IMAGE_TAG
ARG BUILD_DATE
ENV GIT_BRANCH=${GIT_BRANCH}
ENV GIT_COMMIT=${GIT_COMMIT}
ENV IMAGE_TAG=${IMAGE_TAG}
ENV BUILD_DATE=${BUILD_DATE}
RUN echo "GIT_BRANCH=${GIT_BRANCH}" > /var/vision/build_info
RUN echo "GIT_COMMIT=${GIT_COMMIT}" >> /var/vision/build_info
RUN echo "IMAGE_TAG=${IMAGE_TAG}" >> /var/vision/build_info
RUN echo "BUILD_DATE=${BUILD_DATE}" >> /var/vision/build_info
# Run cron
CMD ["/bin/sh", "-c", "crond -f"]