mirror of
https://github.com/hpware/news-analyze.git
synced 2025-06-23 13:04:23 +00:00
feat: update Dockerfile and .dockerignore for improved build process and dependency management
This commit is contained in:
parent
50846c91c2
commit
2e9845c268
2 changed files with 28 additions and 13 deletions
|
@ -5,3 +5,8 @@ node_modules
|
||||||
dist
|
dist
|
||||||
.git
|
.git
|
||||||
.env
|
.env
|
||||||
|
.DS_Store
|
||||||
|
npm-debug.log
|
||||||
|
yarn-debug.log
|
||||||
|
yarn-error.log
|
||||||
|
.env.*
|
34
Dockerfile
34
Dockerfile
|
@ -1,28 +1,38 @@
|
||||||
# Building process
|
|
||||||
FROM oven/bun:latest as builder
|
FROM oven/bun:latest as builder
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
# Copy dependency files
|
|
||||||
COPY package.json bun.lockb ./
|
# Copy package.json first
|
||||||
RUN bun install --frozen-lockfile
|
COPY package.json ./
|
||||||
# Copy source files
|
|
||||||
|
# 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 . .
|
COPY . .
|
||||||
# Framework-specific build command
|
|
||||||
|
# Build the application
|
||||||
RUN bun run build
|
RUN bun run build
|
||||||
|
|
||||||
# Production image
|
# Production stage
|
||||||
FROM oven/bun:latest
|
FROM oven/bun:latest
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy built assets and dependencies
|
# Copy built assets and dependencies
|
||||||
COPY --from=builder /app/.output /app/.output
|
COPY --from=builder /app/.output /app/.output
|
||||||
COPY --from=builder /app/dist /app/dist
|
COPY --from=builder /app/dist /app/dist
|
||||||
COPY --from=builder /app/build /app/build
|
COPY --from=builder /app/build /app/build
|
||||||
COPY --from=builder /app/package.json /app/package.json
|
COPY --from=builder /app/package.json ./
|
||||||
COPY --from=builder /app/bun.lockb /app/bun.lockb
|
COPY --from=builder /app/bun.lockb* ./
|
||||||
# If you have customized your output directory, please add your custom one here, or just remove it. :)
|
# 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
|
EXPOSE 3000
|
||||||
# Map the prod command to start via editing your package.json like in the example.package.json
|
|
||||||
CMD ["bun", "run", "start"]
|
CMD ["bun", "run", "start"]
|
Loading…
Add table
Add a link
Reference in a new issue