File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,19 +20,28 @@ RUN DATABASE_URL="postgresql://build:build@localhost:5432/build" bun run db:gene
2020# tsc first: --compile drops emitDecoratorMetadata (needed by tsyringe) when fed TS.
2121RUN ./node_modules/.bin/tsc
2222RUN cp -r src/generated dist/apps/api/src/generated
23+
24+ # sharp is a native addon — bun --compile can't embed its .node binaries, so keep
25+ # it external and ship only its dependency closure (built for musl) at runtime.
2326RUN bun build --compile --minify-whitespace --minify-syntax \
2427 --define 'process.env.NODE_ENV="production"' \
28+ --external sharp \
2529 --target bun-linux-x64 \
2630 --outfile /app/server \
2731 dist/apps/api/src/app.js
2832
33+ RUN mkdir -p /native && cd /native \
34+ && echo '{"name":"native","version":"0.0.0"}' > package.json \
35+ && bun add sharp@^0.34.5
36+
2937FROM alpine:latest AS runner
3038WORKDIR /app/apps/api
3139
3240RUN apk add --no-cache openssl curl libstdc++ libgcc
3341
3442COPY --from=build /app/server ./server
3543COPY --from=build /app/apps/api/prisma ./prisma
44+ COPY --from=build /native/node_modules ./node_modules
3645
3746RUN mkdir -p uploads
3847
You can’t perform that action at this time.
0 commit comments