Skip to content
This repository was archived by the owner on Apr 10, 2025. It is now read-only.

Commit 4f93e02

Browse files
committed
Merge branch 'standard-build' into 'master'
Switches to the ix.ai ci-templates build pipeline See merge request ix.ai/mariadb-backup!2
2 parents d923476 + a2f2adf commit 4f93e02

File tree

3 files changed

+11
-39
lines changed

3 files changed

+11
-39
lines changed

.gitlab-ci.yml

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,7 @@
11
variables:
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

Dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ FROM debian:buster
22
LABEL MAINTAINER="docker@ix.ai"
33
ENV 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-
1818
VOLUME ["/backup"]
1919
WORKDIR /backup
2020

21-
CMD ["/init.sh"]
21+
ENTRYPOINT ["/app/mariadb-backup.sh"]

init.sh renamed to src/mariadb-backup.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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"

0 commit comments

Comments
 (0)