diff --git a/.dockerignore b/.dockerignore index 8936bf2..281bd19 100644 --- a/.dockerignore +++ b/.dockerignore @@ -4,4 +4,9 @@ node_modules .next dist .git -.env \ No newline at end of file +.env +.DS_Store +npm-debug.log +yarn-debug.log +yarn-error.log +.env.* \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 0a7981e..39d240b 100755 --- a/Dockerfile +++ b/Dockerfile @@ -1,28 +1,38 @@ -# Building process FROM oven/bun:latest as builder + WORKDIR /app -# Copy dependency files -COPY package.json bun.lockb ./ -RUN bun install --frozen-lockfile -# Copy source files + +# Copy package.json first +COPY package.json ./ + +# Copy lock files if they exist (support both bun and npm/yarn) +COPY bun.lockb* package-lock.json* yarn.lock* ./ + +# Install dependencies +RUN bun install --frozen-lockfile || bun install + +# Copy remaining source files COPY . . -# Framework-specific build command + +# Build the application RUN bun run build -# Production image +# Production stage FROM oven/bun:latest + WORKDIR /app + # Copy built assets and dependencies COPY --from=builder /app/.output /app/.output COPY --from=builder /app/dist /app/dist COPY --from=builder /app/build /app/build -COPY --from=builder /app/package.json /app/package.json -COPY --from=builder /app/bun.lockb /app/bun.lockb +COPY --from=builder /app/package.json ./ +COPY --from=builder /app/bun.lockb* ./ # If you have customized your output directory, please add your custom one here, or just remove it. :) -# Install production dependencies only -RUN bun install --production --frozen-lockfile + +# Install production dependencies +RUN bun install --production EXPOSE 3000 -# Map the prod command to start via editing your package.json like in the example.package.json CMD ["bun", "run", "start"] \ No newline at end of file