Hi everyone!
I apology if this is not the right place to ask for Docker questions. Simply let me know, and I'll delete this post.
I moved some code to a monorepo. Everything works fine, except Docker acting weirdly
I have a structure like this one:
|
| - apps
| - - api
| - - frontend
|
| - packages
| - - types
I have a dockerfile which is reusable across apps, it looks like this:
COPY ./package.json ./pnpm-lock.yaml ./pnpm-workspace.yaml ./
COPY ./patches ./patches
COPY ./packages ./packages
COPY apps/${APP}/package.json ./apps/${APP}/
# Precache the deps, dirty workaround I've figured out to reuse the cache when deploying the app
RUN --mount=type=cache,target=${PNPM_HOME}/store pnpm fetch --filter "./apps/${APP}..." --filter "./packages/*..."
COPY ./apps/${APP}/ ./apps/${APP}
RUN --mount=type=cache,target=${PNPM_HOME}/store pnpm install --frozen-lockfile --filter "./apps/${APP}..." --filter "./packages/*..."
RUN pnpm --filter "./packages/*..." build
# Only export the package we're building
RUN --mount=type=cache,target=${PNPM_HOME}/store pnpm deploy --filter ./apps/${APP}... out
It works fine, but when I edit my types package, I have to delete the image from Docker desktop (or cli, both works), before starting the containers with the build flag. How can I avoid the manual image deletion process?
Any help is welcome.
Best regards