-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
35 lines (29 loc) · 1.51 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
ARG pg_alpine_branch
FROM alpine:${pg_alpine_branch}
ARG pg_alpine_branch
ARG pg_version
#--------------------------------------------------------------------------------
# Install dependencies
#--------------------------------------------------------------------------------
# "postgresql" is required for "pg_restore"
# "python" is required for "aws-cli"
#--------------------------------------------------------------------------------
RUN echo "http://dl-cdn.alpinelinux.org/alpine/v${pg_alpine_branch}/main" >> /etc/apk/repositories
RUN apk --no-cache add dumb-init postgresql=${pg_version} python py-pip && \
pip install awscli && \
apk --purge -v del py-pip
#--------------------------------------------------------------------------------
# Set script permissions and create required directories
#--------------------------------------------------------------------------------
COPY action.sh /
RUN chmod +x action.sh
RUN mkdir -p /cache
#--------------------------------------------------------------------------------
# Use the `dumb-init` init system (PID 1) for process handling
#--------------------------------------------------------------------------------
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
#--------------------------------------------------------------------------------
# Configure and apply a cronjob
#--------------------------------------------------------------------------------
CMD echo "${CRON_MINUTE:-$(shuf -i 0-59 -n1)} ${CRON_HOUR:-*} * * * /action.sh" \
> /var/spool/cron/crontabs/root && crond -d 8 -f