-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
66 lines (56 loc) · 1.7 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
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
FROM alpine:3.15.0 AS stage-1
# etcdctl version to use
ENV ETCD_VERSION="v3.5.0"
RUN apk add --no-cache bash git go \
&& apk update \
&& mkdir -p /etcd \
&& mkdir -p /etcd-source \
&& git clone -b ${ETCD_VERSION} https://github.com/etcd-io/etcd.git /etcd-source \
&& cd /etcd-source \
&& ./build.sh \
&& cp /etcd-source/bin/etcdctl /etcd
FROM redhat/ubi8-minimal:8.5-230
# kubectl version to use
ENV KUBE_VERSION="v1.22.4"
# Data path
ENV DATA_PATH="/data"
# location for etcdctl file
ENV ETCD_PATH="/etcd"
# path for snapshots
ENV BAKCUP_PATH="${DATA_PATH}/snapshots"
# Backup path for PKI
ENV PKI_BACKUP_PATH="${DATA_PATH}/pki"
# path for kubectl file
ENV KUBE_PATH="${DATA_PATH}/bin"
# path for log files
ENV LOG_DIR="${DATA_PATH}/logs"
# k8s PKI path
ENV KUBE_PKI_PATH="/etc/kubernetes/pki"
# k8s PKI path for local testing
ENV KUBE_LOCAL_PKI_PATH=""
# etcd PKI Hostpath
ENV ETCD_PKI_HOSTPATH="${KUBE_PKI_PATH}/etcd"
# Default to UTC+0:00 as per current Kubernetes Cronjob limitation
ENV TZ="Etc/GMT"
# Enable/disable deveplopment mode, "off" or "on"
ENV DEV_MODE="off"
# Number of snapshot history to keep
ENV SNAPSHOT_HISTORY_KEEP=3
# Log Level: info, debug
ENV LOG_LEVEL="info"
# Number of PKI backup files set to keep
ENV PKI_HISTORY_KEEP=3
RUN microdnf update -y \
&& microdnf install -y jq wget \
# Change to 'install -y tzdata' when bug is resolved upstream.
&& microdnf reinstall -y tzdata \
&& rm -rf /var/cache \
&& microdnf clean all \
&& mkdir -p ${ETCD_PATH}
WORKDIR ${ETCD_PATH}/
COPY --from=stage-1 /etcd ./
COPY ./run-backup.sh ${ETCD_PATH}/
RUN chmod -R +x ${ETCD_PATH}/* \
&& chown -R root:root ${ETCD_PATH}
USER root
CMD "${ETCD_PATH}/run-backup.sh"