From 8d52349fb503ccdbf066553961d80c32da47c4c2 Mon Sep 17 00:00:00 2001 From: Rudi MK Date: Tue, 26 Nov 2024 08:23:37 +0000 Subject: [PATCH] Added support for Bun executables. --- Dockerfile | 9 ++++----- package.json | 4 ++++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 586d687..fb27419 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,14 +24,13 @@ COPY . . # [optional] tests & build ENV NODE_ENV=production RUN bun test +RUN bun run build -# copy production dependencies and source code into final image +# copy production app into the final image FROM base AS release -COPY --from=install /temp/prod/node_modules node_modules -COPY --from=prerelease /usr/src/app/index.ts . -COPY --from=prerelease /usr/src/app/package.json . +COPY --from=prerelease /usr/src/app/app . # run the app USER bun EXPOSE 3000/tcp -ENTRYPOINT [ "bun", "run", "index.ts" ] \ No newline at end of file +ENTRYPOINT [ "./app" ] \ No newline at end of file diff --git a/package.json b/package.json index 75888da..c700141 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,10 @@ "name": "bun-getting-started", "module": "index.ts", "type": "module", + "scripts": { + "dev": "bun run --watch index.ts", + "build": "bun build index.ts --target bun --compile --outfile app" + }, "devDependencies": { "@types/bun": "latest" },