Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bun install --production enforce more settings than the docs state #10949

Open
Igloczek opened this issue May 9, 2024 · 0 comments
Open

bun install --production enforce more settings than the docs state #10949

Igloczek opened this issue May 9, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Igloczek
Copy link

Igloczek commented May 9, 2024

What version of Bun is running?

1.1.7

What platform is your computer?

Darwin 23.4.0 arm64 arm

What steps can reproduce the bug?

This is part of the stuff I'm doing to build a production Docker image for my app

FROM oven/bun:1.1.7-slim as base
FROM base as build

# Install all deps + manually add shap, since it need to fetch the correct native bindings
RUN bun install && bun add sharp

# Build the app
RUN bun run build

# Remove deps there were necessary only to build the app - pnpm prune equivalent
RUN rm -rf node_modules && bun install --production

FROM base

# Copy built application
COPY --from=build /app/node_modules ./node_modules
COPY --from=build /app/dist ./dist
COPY --from=build /app/.env ./.env
COPY --from=build /app/server.mjs ./server.mjs

# Few more things to run the app

What is the expected behavior?

According to docs it should just To install in production mode (i.e. without devDependencies or optionalDependencies):, but in reality it enforces frozen lockfile and some more undocumented stuff

bun/src/install/install.zig

Lines 6056 to 6063 in 50fd2b0

if (bun_install.production) |production| {
if (production) {
this.local_package_features.dev_dependencies = false;
this.enable.fail_early = true;
this.enable.frozen_lockfile = true;
this.enable.force_save_lockfile = false;
}
}

What do you see instead?

0.662 bun install v1.1.7 (b0b7db5c)
0.686 error: lockfile had changes, but lockfile is frozen
0.686 note: try re-running without --frozen-lockfile and commit the updated lockfile

Additional information

For me, the best option would be to just have bun install prune that will simply remove the devDependecies, without a need to reinstall anything. But at least describing what --production does and having some option to not install devDeps would do too.

@Igloczek Igloczek added the bug Something isn't working label May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant