npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

docker-tar-pusher

v2.1.1

Published

A small tool that allows pushing tar files directly to a Docker registry.

Downloads

198

Readme

docker-tar-pusher

build

With this library you can push tar Docker images directly to a Docker registry without the need of having them loaded into the Docker Engine, re-tagging and pushing.

The library uses chunked upload to push the layers.

Supports HTTP Basic auth.

How to use

First, you have to create a configuration object with the following properties:

  • registryUrl: address of the registry
  • tarball: absolute path to tar file
  • chunkSize (optional): size of chunks, defaults to 10 MiB (10 * 1024 * 1024)
  • logger (optional): specify custom applicationLogger, defaults to console.log
  • sslVerify (optional): should reject invalid TLS certificates, defaults to true
  • auth (optional): HTTP Basic auth containing the username and password, defaults to empty
  • image (optional): image name and version, defaults to empty

Then, you can create a new instance of the DockerTarPusher class with the configuration object. After that, you can call the pushToRegistry method to start the upload process.

Clean-up

After a successful upload, the library will take care about cleaning up the temporary files that have been created during the process. However, you might want to call this clean-up function on in one of your shutdown hooks in order to remove any leftovers in case the application exists unexpectedly.

Examples

Quickstart

import { DockerTarPusher, DockerTarPusherOptions } from 'docker-tar-pusher';

const options: DockerTarPusherOptions = {
  registryUrl: 'http://localhost:5000',
  tarball: 'path/to/file.tar'
};
const dockerTarPusher = new DockerTarPusher(options);

await dockerTarPusher.pushToRegistry();

Complete example with custom logger

import { DockerTarPusher, DockerTarPusherOptions, Logger } from 'docker-tar-pusher';

const myLogger: Logger = {
  error: (msg: string): void => {
    console.log(`[ERROR] ${msg}`);
  },
  warn: (msg: string): void => {
    console.log(`[WARN] ${msg}`);
  },
  info: (msg: string): void => {
    console.log(`[INFO] ${msg}`);
  },
  debug: (msg: string): void => {
    console.log(`[DEBUG] ${msg}`);
  }
};

const options: DockerTarPusherOptions = {
  registryUrl: 'http://localhost:5000',
  tarball: 'path/to/file.tar',
  chunkSize: 8 * 1024 * 1024,
  applicationLogger: myLogger,
  sslVerify: false,
  auth: {
    username: 'testuser',
    password: 'testpassword'
  },
  image: {
    name: 'my-image',
    version: '1.2.3'
  }
};
const dockerTarPusher = new DockerTarPusher(options);

// Attaching clean-up logic to shutdown hook
process.on('SIGINT', () => {
  dockerTarPusher.cleanUp();
});

(async () => {
  await dockerTarPusher.pushToRegistry();
})();

License

MIT

Inspired by dockerregistrypusher