Skip to content

Commit

Permalink
Fix build issues - bun 1.2.1 causing vite issues
Browse files Browse the repository at this point in the history
  • Loading branch information
zx8086 committed Jan 30, 2025
1 parent 2804c1b commit 9bebd60
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker-ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ jobs:
- name: Set up Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
bun-version: '1.2.0'

- name: Cache Bun dependencies
uses: actions/cache@v3
Expand Down
28 changes: 13 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,32 @@
# Base stage
FROM oven/bun:canary-alpine AS builder

# Set build arguments
# Set build arguments first since they rarely change
ARG BUILD_VERSION=development
ARG COMMIT_HASH=unknown
ARG BUILD_DATE
ARG NODE_ENV=production
ARG NODE_ENV=development

# Set environment variables
# Set as environment variables for build process
ENV BUILD_VERSION=${BUILD_VERSION}
ENV COMMIT_HASH=${COMMIT_HASH}
ENV BUILD_DATE=${BUILD_DATE}
ENV NODE_ENV=${NODE_ENV}
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
ENV LC_CTYPE=C.UTF-8

WORKDIR /app

# Copy package files and install dependencies
# Copy package files first for better cache utilization
COPY package.json bun.lockb ./
RUN --mount=type=cache,target=/root/.bun/install/cache \
bun install --frozen-lockfile

# Copy all files and build the application
# Copy all files after dependency installation
COPY . .
RUN --mount=type=cache,target=/root/.bun/install/cache \
bun run svelte-kit sync && \

# Build the application
RUN bun run svelte-kit sync && \
NODE_ENV=${NODE_ENV} \
DISABLE_OPENTELEMETRY=true \
bun run build:no-telemetry

# Production image
Expand All @@ -40,23 +40,21 @@ ARG COMMIT_HASH
ARG BUILD_DATE
ARG NODE_ENV

# Set environment variables for runtime
# Set as environment variables for runtime
ENV BUILD_VERSION=${BUILD_VERSION}
ENV COMMIT_HASH=${COMMIT_HASH}
ENV BUILD_DATE=${BUILD_DATE}
ENV NODE_ENV=${NODE_ENV}
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
ENV LC_CTYPE=C.UTF-8

WORKDIR /app

# Copy everything from builder
COPY --from=builder /app/ ./

# Install production dependencies
# Install production dependencies with cache
RUN --mount=type=cache,target=/root/.bun/install/cache \
bun install --production --frozen-lockfile && \
mkdir -p src/data && \
chown -R bun:bun /app

USER bun
Expand Down
Binary file modified bun.lockb
Binary file not shown.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"@sveltejs/adapter-auto": "^4.0.0",
"@sveltejs/adapter-node": "^5.2.11",
"@sveltejs/kit": "^2.15.3",
"@sveltejs/vite-plugin-svelte": "^3.0.3",
"@sveltejs/vite-plugin-svelte": "^5.0.3",
"@tailwindcss/forms": "^0.5.10",
"@types/bun": "^1.1.16",
"@types/node": "^22.10.7",
Expand All @@ -49,15 +49,15 @@
"bun-types": "^1.1.43",
"postcss": "^8.5.1",
"process": "^0.11.10",
"svelte": "^5.19.0",
"svelte": "^5.18.0",
"svelte-adapter-bun": "^0.5.2",
"svelte-check": "^4.1.4",
"tailwindcss": "^3.4.17",
"typescript": "^5.7.3",
"vite": "^5.4.14"
"vite": "^6.0.7"
},
"dependencies": {
"@apollo/client": "3.11.0",
"@apollo/client": "^3.12.8",
"@azure/identity": "^4.6.0",
"@azure/msal-browser": "^4.0.1",
"@azure/msal-node": "^3.0.1",
Expand All @@ -70,7 +70,7 @@
"@openreplay/tracker-graphql": "^4.1.0",
"@openreplay/tracker-profiler": "^3.0.1",
"@opentelemetry/api": "^1.9.0",
"@opentelemetry/auto-instrumentations-node": "^0.55.2",
"@opentelemetry/auto-instrumentations-node": "^0.56.0",
"@opentelemetry/context-zone": "^1.30.1",
"@opentelemetry/core": "^1.30.1",
"@opentelemetry/exporter-logs-otlp-http": "^0.57.1",
Expand Down Expand Up @@ -106,7 +106,7 @@
"mode-watcher": "^0.5.0",
"net": "^1.0.2",
"node-cron": "^3.0.3",
"openai": "^4.78.1",
"openai": "^4.81.0",
"os": "^0.1.2",
"papaparse": "^5.5.1",
"svelte-sonner": "^0.3.28",
Expand Down

0 comments on commit 9bebd60

Please sign in to comment.