# -*- mode: bash -*-

GOGOCARTOJS_CODE="$SERVICE_DATASTORE/opt/apps/gogocartojs"
GOGOCARTOJS_DOCKER_IMAGE=docker.0k.io/gogocartojs:1.0.0

gogocartojs:build() {
    docker pull "$GOGOCARTOJS_DOCKER_IMAGE" || return 1
    container_id=$(docker run -d --entrypoint true "$GOGOCARTOJS_DOCKER_IMAGE") || return 1
    mkdir -p "$GOGOCARTOJS_CODE" &&
        docker cp "$container_id":/opt/apps/gogocartojs/build "$GOGOCARTOJS_CODE"/ &&
        docker cp "$container_id":/opt/apps/gogocartojs/web "$GOGOCARTOJS_CODE"/ &&
        docker cp "$container_id":/opt/apps/gogocartojs/dist "$GOGOCARTOJS_CODE"/ &&
        docker cp "$container_id":/opt/apps/gogocartojs/assets "$GOGOCARTOJS_CODE"/ &&
        docker rm "$container_id"
}