|
1 | | -FROM alpine:3.6 |
| 1 | +ARG alpine_version |
| 2 | +FROM alpine:${alpine_version} |
2 | 3 |
|
3 | | -ARG pg_alpine_branch |
4 | | -ARG pg_version |
| 4 | +ARG alpine_version |
| 5 | +ARG pg_package_version |
5 | 6 |
|
6 | | -# python for aws-cli, for s3 uploading, jq for dealing with AWS Cli |
7 | | -RUN apk --no-cache add python py-pip jq && \ |
8 | | - pip install awscli && \ |
9 | | - apk --purge -v del py-pip |
| 7 | +#-------------------------------------------------------------------------------- |
| 8 | +# Install dependencies |
| 9 | +#-------------------------------------------------------------------------------- |
| 10 | +# "postgresql" is required for "pg_restore" |
| 11 | +# "py-pip" is required for "aws-cli" |
| 12 | +#-------------------------------------------------------------------------------- |
| 13 | +RUN echo "http://dl-cdn.alpinelinux.org/alpine/v${alpine_version}/main" >> /etc/apk/repositories |
10 | 14 |
|
11 | | -# postgresql for pg_dump |
12 | | -RUN echo "http://dl-cdn.alpinelinux.org/alpine/${pg_alpine_branch}/main" >> /etc/apk/repositories |
13 | | -RUN echo ${pg_version}; apk --no-cache add postgresql=${pg_version} |
| 15 | +RUN apk --no-cache --update add dumb-init postgresql=${pg_package_version} curl python3 && \ |
| 16 | + curl https://bootstrap.pypa.io/get-pip.py | python3 && \ |
| 17 | + pip install awscli && \ |
| 18 | + rm -f /usr/bin/pip && \ |
| 19 | + apk --purge -v del curl |
14 | 20 |
|
| 21 | +#-------------------------------------------------------------------------------- |
| 22 | +# Set script permissions and create required directories |
| 23 | +#-------------------------------------------------------------------------------- |
15 | 24 | COPY action.sh / |
16 | 25 | RUN chmod +x action.sh |
17 | 26 |
|
| 27 | +#-------------------------------------------------------------------------------- |
| 28 | +# Use the `dumb-init` init system (PID 1) for process handling |
| 29 | +#-------------------------------------------------------------------------------- |
| 30 | +ENTRYPOINT ["/usr/bin/dumb-init", "--"] |
| 31 | + |
| 32 | +#-------------------------------------------------------------------------------- |
| 33 | +# Configure and apply a cronjob |
| 34 | +#-------------------------------------------------------------------------------- |
18 | 35 | CMD echo "${CRON_MINUTE:-$(shuf -i 0-59 -n1)} ${CRON_HOUR:-*} * * * /action.sh" > /var/spool/cron/crontabs/root && crond -d 8 -f |
0 commit comments