azukiapp / azk

azk is a lightweight open source development environment orchestration tool. Instantly & safely run any environment on your local machine.
http://azk.io
Apache License 2.0
897 stars 63 forks source link

build using dockerfile in docker v1.11 #664

Open FDiskas opened 8 years ago

FDiskas commented 8 years ago

chat in gitter: 27 de Abril de 2016 14:29

$ azk version --full

Version   : azk version 0.18.0, build 8b9f66c, date 2016-04-06
OS        : Linux 4.4 (x64), Memory: 15772MB
Agent     : Running
Docker    : 1.11.0
Uses VM   : No
VirtualBox: N/A

Azkfile.js

systems({
    FrontKit: {
        // Make sure that not root user is used
        docker_extra: {
            "User": "1000"
        },
        // Dependent systems
        depends: [],
        // More images:  http://images.azk.io
        image: {
            dockerfile: "./.docker"
        },
        // Steps to execute before running instances
        provision: [
            "npm install"
        ],
        workdir: "/azk/#{manifest.dir}",
        shell: "/bin/bash",
        command: ["./node_modules/.bin/gulp"],
        wait: 20,
        mounts: {
            '/azk/#{manifest.dir}': sync("."),
            '/azk/#{manifest.dir}/node_modules': persistent("./node_modules"),
        },
        scalable: {"default": 1},
        http: {
            domains: ["#{system.name}.#{azk.default_domain}"]
        },
        ports: {
            // exports global variables
            http: "3000/tcp"
        },
        envs: {
            // Make sure that the PORT value is the same as the one
            // in ports/http below, and that it's also the same
            // if you're setting it in a .env file
            NODE_ENV: "dev",
            PORT: "3000"
        }
    }
});

./.docker/Dockerfile

FROM node
RUN npm install -g gulp
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
RUN useradd -ms /bin/bash cli
RUN usermod -u 1000 cli
RUN mkdir -p /azk
RUN chown 1000:1000 /azk
RUN chown -R 1000:1000 /azk
WORKDIR /azk
CMD ["bash"]
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]

./.docker/entrypoint.sh

#!/bin/bash

# Keep docker container alive
while true; do sleep 1000; done

I tryed:

sudo rm -rf ~/.azk/data/persistent_folders
sudo rm -rf ~/.azk/data/sync_folders

.azk/data/logs/azk.log

2016-04-27T17:40:46.603Z - warn: [promise] Error: [sprintf] property 'error' does not exist
    at sprintf.format (/usr/lib/azk/node_modules/i18n-cli/node_modules/sprintf-js/src/sprintf.js:37:35)
    at sprintf (/usr/lib/azk/node_modules/i18n-cli/node_modules/sprintf-js/src/sprintf.js:21:31)
    at I18n._format (i18n-cli-0.0.3 - src/index.js:2:17)
    at I18n.translate (i18n-cli-0.0.3 - src/index.js:63:32)
    at I18n.t (i18n-cli-0.0.3 - src/index.js:35:28)
    at DockerBuildError.AzkError.toString (workspace-0.18.0 - src/utils/errors.js:1:14)
    at Object._status (workspace-0.18.0 - src/cli/ui.js:80:26)
    at Object.fail (workspace-0.18.0 - src/cli/ui.js:71:36)
    at AskSendErrorView.UIProxy.(anonymous function) [as fail] (workspace-0.18.0 - src/cli/ui.js:240:37)
    at GeneratorFunction._callee$ (workspace-0.18.0 - src/cli/error_handler.js:49:10)
    at tryCatch (/usr/lib/azk/node_modules/babel-polyfill/node_modules/babel-regenerator-runtime/runtime.js:61:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/lib/azk/node_modules/babel-polyfill/node_modules/babel-regenerator-runtime/runtime.js:329:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/usr/lib/azk/node_modules/babel-polyfill/node_modules/babel-regenerator-runtime/runtime.js:94:21)
    at GeneratorFunctionPrototype.tryCatcher (/usr/lib/azk/node_modules/bluebird/js/release/util.js:11:23)
    at PromiseSpawn._promiseFulfilled (/usr/lib/azk/node_modules/bluebird/js/release/generators.js:90:49)
    at GeneratorFunction.<anonymous> (/usr/lib/azk/node_modules/bluebird/js/release/generators.js:182:15)

As an alternative I did the folowing

adocker build -t frontkit .docker

Then in Azkfile.js

image: {
            docker: "frontkit"
        },
gullitmiranda commented 8 years ago

related to project: https://github.com/CodersAKL/FrontKit