Skip to content

What's the proper way to use zero-installs with docker? #3201

Answered by cometkim
gex asked this question in Q&A
Discussion options

You must be logged in to vote

I'm using @Dcard's yarn-plugin-docker-build to get optimized docker image in monorepo

It performs dependency analysis and integrates elegantly with the yarn pack script, leaving only minimal production artifacts.

I got an image that was reduced by 60% compared to the previous image.

My Dockerfile looks like:

FROM node:14-alpine as builder

WORKDIR /usr/src/app

COPY manifests ./
RUN yarn install --immutable

FROM node:14-alpine

# Some build args here...
ARG ...=...

WORKDIR /usr/src/app

COPY --from=builder /usr/src/app/.pnp.js                      ./
COPY --from=builder /usr/src/app/.yarn/cache/                 .yarn/cache/
COPY --from=builder /usr/src/app/.yarn/patches/               .…

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@gex
Comment options

@DanielKlys7
Comment options

@gabormagyar
Comment options

Answer selected by gex
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants