Coder Social home page Coder Social logo

pruner's Introduction

Pruner

Will prune node_modules so your final Docker images is smaller. Cuts about 10 to 20 percent off. Comes handy if you’re dealing with limited resources or work at a scale of thousands of projects. Or you’re just obsessed with small deployments.

Install

This package is hosted in jsr.dev, but you can install it with your normal tools:

pnpm dlx jsr add -D @antti/pruner

It’s a single JavaScript file with no deps, so you can just copy it to your project if you don’t want to install it.

Usage

pnpm dlx @antti/pruner --path=node_modules/.pnpm
# Or
pnpm pruner --path=node_modules/.pnpm

Example usage in Dockerfile:

FROM node:lts-alpine3.19 AS base
RUN corepack enable
WORKDIR /usr/src/app
COPY pnpm-lock.yaml .
RUN pnpm fetch
COPY . .
RUN pnpm i --offline --frozen-lockfile
RUN pnpm build
RUN pnpm -F=foo --prod deploy /myapp/foo
# Run it as the last command step of the build step
RUN pnpm pruner --path=/myapp/foo/node_modules/.pnpm

# Enjoy slimmer image
FROM node:lts-alpine3.19 AS foo
COPY --from=base /myapp/foo /myapp/foo
WORKDIR /myapp/foo
CMD node build/server.js

Other packages

pruner's People

Contributors

hilja avatar

Watchers

 avatar  avatar

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.