Dockerfile 865 Bytes
Newer Older
Dominik Hebeler's avatar
Dominik Hebeler committed
1
2
3
4
FROM dtzar/helm-kubectl

RUN apk add --update \
    curl \
Dominik Hebeler's avatar
Dominik Hebeler committed
5
    jq \
Dominik Hebeler's avatar
Dominik Hebeler committed
6
7
8
    php7-cli \
    php7-curl \
    php7-json \
Dominik Hebeler's avatar
Dominik Hebeler committed
9
    php7-openssl \
Dominik Hebeler's avatar
Dominik Hebeler committed
10
11
12
13
14
    && rm -rf /var/cache/apk

COPY scripts /scripts
WORKDIR /scripts

Dominik Hebeler's avatar
Dominik Hebeler committed
15
CMD php deleteOldBranches.php && \
Dominik Hebeler's avatar
Dominik Hebeler committed
16
17
    helm repo add gitlab https://charts.gitlab.io/ && \
    helm repo update && \
Dominik Hebeler's avatar
Dominik Hebeler committed
18
19
20
21
22
23
    export GITLAB_VERSION=$(helm ls -o json | jq -c -r '.[] | select(.name == "gitlab") | .chart' | cut -d"-" -f2) && \
    helm get values gitlab > gitlab.yml && \
    helm upgrade gitlab gitlab/gitlab -f gitlab.yml --version=$GITLAB_VERSION --set registry.maintenance.readOnly.enabled=true --wait && \
    POD=$(kubectl -n gitlab-suma get pods -l app=registry -o jsonpath='{.items[0].metadata.name}') && \
    kubectl exec $pod --/bin/registry garbage-collect && \
    helm upgrade gitlab gitlab/gitlab -f gitlab.yml --version=$GITLAB_VERSION