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

bunx --bun vite build throw undefined error in docker image build in github actions in sveltekit project #10811

Closed
IslamZaoui opened this issue May 3, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@IslamZaoui
Copy link

What version of Bun is running?

1.1.7

What platform is your computer?

windows

What steps can reproduce the bug?

building my Sveltekit project for production on my local machine works fine but when I commit my change and github build it it causes an undefined

What is the expected behavior?

to build successfully

What do you see instead?

image

Additional information

this happened randomly, between 2 commits nothing really changes

@IslamZaoui IslamZaoui added the bug Something isn't working label May 3, 2024
@IslamZaoui
Copy link
Author

this my dockerfile:

FROM oven/bun:1.1 as base

ENV PUBLIC_POCKETBASE_URL=http://db:8080
ENV ORIGIN=http://localhost:3000

WORKDIR /usr/src/app

# install dependencies into temp directory
# this will cache them and speed up future builds
FROM base AS install
RUN mkdir -p /temp/dev
COPY package.json bun.lockb /temp/dev/
RUN cd /temp/dev && bun install --frozen-lockfile

# install with --production (exclude devDependencies)
RUN mkdir -p /temp/prod
COPY package.json bun.lockb /temp/prod/
RUN cd /temp/prod && bun install --frozen-lockfile --production

# copy node_modules from temp directory
# then copy all (non-ignored) project files into the image
FROM base AS prerelease
COPY --from=install /temp/dev/node_modules node_modules
COPY . .

# tests & build
ENV NODE_ENV=production
RUN bun run build -- --debug

# copy production dependencies and source code into final image
FROM base AS release
COPY --from=install /temp/prod/node_modules node_modules
COPY --from=prerelease /usr/src/app/build .
COPY --from=prerelease /usr/src/app/package.json .

# run the app
EXPOSE 3000
CMD ["bun", "run", "/usr/src/app/index.js"]

@danknessdra
Copy link

same issue

@IslamZaoui
Copy link
Author

I found out that this error is related to svelte-adapter-bun and an import with the wrong letter case.
when I switched to the node adapter the error appeared and I fixed it

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

2 participants