jotrdl / grunt-dock Goto Github PK
View Code? Open in Web Editor NEWA Grunt plugin to manage Docker
License: MIT License
A Grunt plugin to manage Docker
License: MIT License
When I run any task like grunt dock:list
, there is no result coming out. It seems like the plugin is not working.
My Gruntfile.js:
var fs = require('fs'),
path = require('path'),
utils = require('grunt-dock/lib/utils');
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
var caPath = path.resolve(utils.getUserHome(), '.boot2docker/certs/boot2docker-vm/', 'ca.pem'),
certPath = path.resolve(utils.getUserHome(), '.boot2docker/certs/boot2docker-vm/', 'cert.pem'),
keyPath = path.resolve(utils.getUserHome(), '.boot2docker/certs/boot2docker-vm/', 'key.pem');
grunt.initConfig({
dock: {
options: {
// Docker connection options
// For this example, assume it is a Boot2Docker config.
// By default, Boot2Docker only accepts secure connection.
docker: {
protocol: 'https',
host: '192.168.59.99',
port: '2376',
ca: fs.readFileSync(caPath),
cert: fs.readFileSync(certPath),
key: fs.readFileSync(keyPath)
},
images: {
// The 'simple' image
'tjwudi/wudi-link': {
// The Dockerfile to use
dockerfile: './Dockerfile',
// Options for dockerode
options: {
// When starting the container:
// Bind the container port to the host (same port)
// +
// Bind the './bundle' directory to the '/bundle' container one
start: {
"PortBindings": { "3000/tcp": [ { "HostPort": "8080" } ] },
"Binds":[__dirname + ":/src"]
},
// For the logs command, we want to display stdout
logs: { stdout: true }
}
}
}
}
}
});
require('grunt-dock/tasks/dock')(grunt);
};
hi,
would it be possible to auto populate auth data from:
$HOME/.docker/config.json
the reason is mostly so that a single user do not have to encode auth details in a shared Gruntfile.js
or is there some other way?
It would be useful to also have Run (for watch like tasks) and Push/Pull commands. Push/Pull would be useful for deployment tasks (or? etc...).
If I have some time I can create some pull requests for this tasks.
I have problem with grunt dock:dev:build command, the image is not tagged and therefore not found when runt grunt dock:dev:start. Tried with grunt-dock: 1.0.2 and 1.0.1 , nodejs 0.10 and 0.12
Runing docker build -t myname . works fine. And after this grunt dock:dev:start works fine.
Also I noticed that changing Dockerfile doesn't trigger image rebuild on grunt dock:dev:build
My Gruntfile.js
dock: {
dev: {
options: {
docker: {
protocol: 'https',
host: '192.168.99.100',
port: '2376',
ca: fs.readFileSync(dockerMachines.dev.caPath),
cert: fs.readFileSync(dockerMachines.dev.certPath),
key: fs.readFileSync(dockerMachines.dev.keyPath)
},
images: {
'myname': {
dockerfile: 'Dockerfile'
}
}
}
}
}
output from grunt dock:dev:build (which shows it is not using my current Dockerfile)
└─▪ grunt dock:dev:build
Running "dock:dev:build" (dock) task
Building image [myname]
Step 0 : FROM dockerfile/nodejs
---> 3a387fc48869
Step 1 : RUN npm install -g bower grunt-cli
---> Using cache
---> fe7e745bfeec
Step 2 : COPY ./dist /app
>> Build successfuly done.
Done, without errors.
Dockerfile:
FROM dockerfile/nodejs
RUN npm install -g bower grunt-cli
COPY ./dist /app
ADD start.sh /start.sh
ADD start.sh /start.sh2 #trigger a change, should rebuild the image
EXPOSE 8080
CMD ["/start.sh"]
I'm trying to build a docker image with grunt-dock but whenever I get to a ADD or COPY step the build is aborted and >> Build successfuly done
is printed.
This is an example Dockerfile
FROM dockerfile/nodejs
MAINTAINER Torbjørn Vatn <[email protected]>
RUN npm install -g grunt-cli
ADD package.json /data/package.json
RUN ls
When passing a build command through grunt-dock, and specifying a directory as the dockerfile argument, the .dockerignore file is not taken into consideration (ergo, all files are transferred as docker context). Issuing a standard "docker build ..." command in the specified directory works just fine.
Sample configuration for grunt-dock:
images: {
'IMAGE NAME: {
dockerfile: '.',
options: {
build: {
t: 'IMAGE TAG'
}
}
}
}
So, again, running this ignores any .dockerignore files in the current directory.
Hi,
I have a simple, 3-line Dockerfile. The last line is a simple "COPY" command that takes the "dist" directory and drops it into the image container's /usr/share/nginx/html directory. However, when I execute this file I get the following output and error:
Building image [foo]
Step 1 : FROM nginx
---> b4c1ea3cfac2
Step 2 : MAINTAINER Matt Titmus
---> Using cache
---> 16548937824d
Step 3 : COPY dist /usr/share/nginx/html
Warning: lstat dist: no such file or directory� Use --force to continue.
The dist directory definitely exists. :)
Is there a way to define the working directory for the purposes of the docker build? Alternatively, can the plugin define it by default as the directory that the Dockerfile lives in?
We are a group of researchers from Leiden University, and we conduct research on vulnerabilities in open-source software. We have discovered and verified a high-severity vulnerability in your project(JoTrdl/grunt-dock). Explaining the vulnerability further in this issue could allow malicious users to access details, so we recommend enabling private vulnerability reporting on GitHub to discuss this matter confidentially.
After you have enabled this feature, please add a comment to this issue so we can continue our discussion. If you have any questions, feel free to leave a reply here or send an email to: j.akhoundali [at] liacs.leidenuniv.nl
Hi,
we had a problem with the build process for the docker image. The docker remote api response the code 200, although the dockerfile does not work properly (In my case the COPY command). Do you know, where the problem is? I think, the plugin don't log or output the response body.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.