Commit 4f93e021 authored by Alex Thomae's avatar Alex Thomae

Merge branch 'standard-build' into 'master'

Switches to the ix.ai ci-templates build pipeline

See merge request !2
parents d9234765 a2f2adf1
Pipeline #80712640 passed with stages
in 2 minutes and 31 seconds
variables:
DOCKER_DRIVER: overlay2
DOCKERHUB_REPO_PREFIX: ixdotai
DOCKERHUB_REPO_NAME: mariadb-backup
stages:
- build
.tags-template: &tags-definition
tags:
- ix-ai
.build-template: &build-definition
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
stage: build
script:
- echo "{\"auths\":{\"${CI_REGISTRY}\":{\"username\":\"${CI_REGISTRY_USER}\",\"password\":\"${CI_REGISTRY_PASSWORD}\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context ${CI_PROJECT_DIR} --dockerfile ${CI_PROJECT_DIR}/Dockerfile --destination ${IMAGE_TAG}
build:test:
except:
- master
- latest
before_script:
- export IMAGE_TAG="${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_NAME}"
<<: *tags-definition
<<: *build-definition
build:release:
only:
- master
before_script:
- export IMAGE_TAG="${CI_REGISTRY_IMAGE}:latest"
<<: *tags-definition
<<: *build-definition
include:
- remote: https://gitlab.com/ix.ai/ci-templates/raw/master/bash-project.yml
......@@ -2,7 +2,10 @@ FROM debian:buster
LABEL MAINTAINER="docker@ix.ai"
ENV DEBIAN_FRONTEND=noninteractive TERM=linux DB_PORT=3306 DB_USER=root
RUN groupadd -g 666 mybackup && \
COPY src/ /app
RUN chmod 755 /app/*.sh && \
groupadd -g 666 mybackup && \
useradd -u 666 -g 666 -d /backup -c "MariaDB Backup User" mybackup && \
apt-get update && \
apt-get -y dist-upgrade && \
......@@ -12,10 +15,7 @@ RUN groupadd -g 666 mybackup && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
find /var/log -type f | while read f; do echo -ne '' > $f; done;
COPY init.sh /init.sh
RUN chmod 750 /init.sh
VOLUME ["/backup"]
WORKDIR /backup
CMD ["/init.sh"]
ENTRYPOINT ["/app/mariadb-backup.sh"]
......@@ -151,14 +151,14 @@ then
if [[ "${TARBALL^^}" != "" ]]
then
RESTORE_DIR=${TARBALL}
rm -rf ${RESTORE_DIR}
rm -rf "${RESTORE_DIR}"
echo "===> Restoring database from ${RESTORE_DIR}..."
exec su -pc "tar -xvf ${TARBALL}.tgz ${RESTORE_DIR} && myloader --directory=${RESTORE_DIR} ${CLI_OPTIONS}" ${USER}
else
if [[ -z "${RESTORE_DIR}" ]]
then
printf "===> No RESTORE_DIR set, trying to find latest backup... "
RESTORE_DIR=$(ls -t | head -1)
RESTORE_DIR=$(find . -maxdepth 1)
if [[ -n "${RESTORE_DIR}" ]]
then
echo "DONE"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment