karolyp / docker-tar-pusher Goto Github PK
View Code? Open in Web Editor NEWPush tar images into Docker registry from NodeJS without using the Docker Engine.
License: MIT License
Push tar images into Docker registry from NodeJS without using the Docker Engine.
License: MIT License
https://github.com/karolyp/docker-tar-pusher/blob/master/src/WorkDirUtils.ts#L10-L1
public createTempDir(prefix = 'dtp-'): void {
this.cwd = fs.mkdtempSync(path.join(os.tmpdir(), prefix));
}
If two Docker tars are being uploaded at the same time, they use the same folder. To prevent this, generate pseudo-random folder names, e.g:
import { v4 as uuidv4 } from 'uuid'
public createTempDir(prefix = 'dtp-'): void {
this.cwd = fs.mkdtempSync(path.join(os.tmpdir(), prefix + uuidv4()));
}
To comply with allowing minimum permissions, we'd like to be able to authenticate to our docker registry with a token that provides the access to just push to a single namespace. The registry lets you generate tokens with specific scopes as JWT tokens. It would be useful if this library allowed the user to provide an already generated JWT bearer token that it would use for authentication.
e.g.
const namespace = 'internal'
const image = 'nginx'
# user provided function for generating a token
const token = await generateAccessToken([{ type: 'repository', name: `${namespace}/${image}`, actions: ['push', 'pull'] }])
const options: DockerTarPusherOptions = {
registryUrl: 'http://localhost:5000',
...
auth: {
token
}
}
When accepting user generated tars, we want to force where the images are uploaded to.
Would be useful to have the ability to take in a logger, even if it's just a very simple:
logger: (msg: string) => void
This would let us integrate the module into our existing bunyan logger.
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.