"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.scripts = void 0;
var scripts;
(function (scripts) {
    scripts.init = `
        set -ex

        git init
        git remote add origin $REFLOAT_CLONE_URL
        git fetch origin --depth 1 $REFLOAT_CLONE_SHA
        git checkout -b $REFLOAT_CLONE_BRANCH $REFLOAT_CLONE_SHA

        if [ -n "$REFLOAT_DOCKER_FILE" ]; then
            if [ -z "$REFLOAT_DOCKER_CONTEXT" ]; then
                REFLOAT_DOCKER_CONTEXT="../tmp-docker-ctx"

                mkdir -p "$REFLOAT_DOCKER_CONTEXT"
            fi

            REFLOAT_DOCKER_IMAGE="$REFLOAT_JOB_ID-base"

            docker build -f "$REFLOAT_DOCKER_FILE" -t "$REFLOAT_DOCKER_IMAGE" "$REFLOAT_DOCKER_CONTEXT"
        fi

        if [ -n "$REFLOAT_DOCKER_IMAGE" ]; then
            docker build -f - -t "$REFLOAT_JOB_ID-image" .. << Dockerfile
                FROM $REFLOAT_DOCKER_IMAGE
                WORKDIR /refloat/$REFLOAT_REPO_NAME
                CMD /bin/sh
Dockerfile

            docker run \
                --detach \
                --rm \
                -ti \
                -v $(pwd):/refloat/$REFLOAT_REPO_NAME \
                -v /var/run/docker.sock:/var/run/docker.sock \
                --name "$REFLOAT_JOB_ID" \
                "$REFLOAT_JOB_ID-image"
        fi
    `;
})(scripts = exports.scripts || (exports.scripts = {}));
//# sourceMappingURL=scripts.js.map