This repository was archived by the owner on Apr 10, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +11
-39
lines changed
Expand file tree Collapse file tree 3 files changed +11
-39
lines changed Original file line number Diff line number Diff line change 11variables :
22 DOCKER_DRIVER : overlay2
3+ DOCKERHUB_REPO_PREFIX : ixdotai
4+ DOCKERHUB_REPO_NAME : mariadb-backup
35
4- stages :
5- - build
6-
7- .tags-template : &tags-definition
8- tags :
9- - ix-ai
10-
11- .build-template : &build-definition
12- image :
13- name : gcr.io/kaniko-project/executor:debug
14- entrypoint : [""]
15- stage : build
16- script :
17- - echo "{\"auths\":{\"${CI_REGISTRY}\":{\"username\":\"${CI_REGISTRY_USER}\",\"password\":\"${CI_REGISTRY_PASSWORD}\"}}}" > /kaniko/.docker/config.json
18- - /kaniko/executor --context ${CI_PROJECT_DIR} --dockerfile ${CI_PROJECT_DIR}/Dockerfile --destination ${IMAGE_TAG}
19-
20- build:test :
21- except :
22- - master
23- - latest
24- before_script :
25- - export IMAGE_TAG="${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_NAME}"
26- << : *tags-definition
27- << : *build-definition
28-
29- build:release :
30- only :
31- - master
32- before_script :
33- - export IMAGE_TAG="${CI_REGISTRY_IMAGE}:latest"
34- << : *tags-definition
35- << : *build-definition
6+ include :
7+ - remote : https://gitlab.com/ix.ai/ci-templates/raw/master/bash-project.yml
Original file line number Diff line number Diff line change @@ -2,7 +2,10 @@ FROM debian:buster
22LABEL MAINTAINER="docker@ix.ai"
33ENV DEBIAN_FRONTEND=noninteractive TERM=linux DB_PORT=3306 DB_USER=root
44
5- RUN groupadd -g 666 mybackup && \
5+ COPY src/ /app
6+
7+ RUN chmod 755 /app/*.sh && \
8+ groupadd -g 666 mybackup && \
69 useradd -u 666 -g 666 -d /backup -c "MariaDB Backup User" mybackup && \
710 apt-get update && \
811 apt-get -y dist-upgrade && \
@@ -12,10 +15,7 @@ RUN groupadd -g 666 mybackup && \
1215 rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
1316 find /var/log -type f | while read f; do echo -ne '' > $f; done;
1417
15- COPY init.sh /init.sh
16- RUN chmod 750 /init.sh
17-
1818VOLUME ["/backup" ]
1919WORKDIR /backup
2020
21- CMD ["/init .sh" ]
21+ ENTRYPOINT ["/app/mariadb-backup .sh" ]
Original file line number Diff line number Diff line change @@ -151,14 +151,14 @@ then
151151 if [[ " ${TARBALL^^} " != " " ]]
152152 then
153153 RESTORE_DIR=${TARBALL}
154- rm -rf ${RESTORE_DIR}
154+ rm -rf " ${RESTORE_DIR} "
155155 echo " ===> Restoring database from ${RESTORE_DIR} ..."
156156 exec su -pc " tar -xvf ${TARBALL} .tgz ${RESTORE_DIR} && myloader --directory=${RESTORE_DIR} ${CLI_OPTIONS} " ${USER}
157157 else
158158 if [[ -z " ${RESTORE_DIR} " ]]
159159 then
160160 printf " ===> No RESTORE_DIR set, trying to find latest backup... "
161- RESTORE_DIR=$( ls -t | head - 1)
161+ RESTORE_DIR=$( find . -maxdepth 1)
162162 if [[ -n " ${RESTORE_DIR} " ]]
163163 then
164164 echo " DONE"
You can’t perform that action at this time.
0 commit comments