GithubHelp home page GithubHelp logo

karolyp / docker-tar-pusher Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 1.0 718 KB

Push tar images into Docker registry from NodeJS without using the Docker Engine.

License: MIT License

JavaScript 3.09% TypeScript 96.91%
docker docker-image docker-registry docker-registry-v2 docker-tar

docker-tar-pusher's People

Contributors

karolyp avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

laszlobalint

docker-tar-pusher's Issues

Bug: Race case in temporary directory creation

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()));
  }

Support bearer authentication

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
  }
}

Support custom loggers

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.