forked from bcgov/backup-container
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
38 lines (29 loc) · 1.46 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
# This image provides a postgres installation from which to run backups
FROM centos/postgresql-13-centos7:20210722-70dc4d3
# Change timezone to PST for convenience
ENV TZ=PST8PDT
# Set the workdir to be root
WORKDIR /
# Load the backup scripts into the container (must be executable).
COPY backup.* /
# ========================================================================================================
# Install go-crond (from https://github.com/webdevops/go-crond)
#
# CRON Jobs in OpenShift:
# - https://blog.danman.eu/cron-jobs-in-openshift/
# --------------------------------------------------------------------------------------------------------
ARG SOURCE_REPO=webdevops
ARG GOCROND_VERSION=22.9.1
ADD https://github.com/$SOURCE_REPO/go-crond/releases/download/$GOCROND_VERSION/go-crond.linux.amd64 /usr/bin/go-crond
USER root
RUN chmod +x /usr/bin/go-crond
# ========================================================================================================
# ========================================================================================================
# Perform operations that require root privilages here ...
# --------------------------------------------------------------------------------------------------------
RUN echo $TZ > /etc/timezone
# ========================================================================================================
# Important - Reset to the base image's user account.
USER 26
# Set the default CMD.
CMD sh /backup.sh