19 lines
466 B
Docker
19 lines
466 B
Docker
# Production-ready Dockerfile for Astro
|
|
FROM node:20-alpine AS builder
|
|
WORKDIR /app
|
|
COPY . .
|
|
RUN npm ci && npm run build
|
|
|
|
# Production image
|
|
FROM node:20-alpine AS runner
|
|
WORKDIR /app
|
|
COPY --from=builder /app/package.json ./
|
|
COPY --from=builder /app/node_modules ./node_modules
|
|
COPY --from=builder /app/dist ./dist
|
|
COPY --from=builder /app/public ./public
|
|
|
|
VOLUME ["/app/public", "/app/src/content"]
|
|
|
|
EXPOSE 4321
|
|
CMD ["npx", "astro", "preview", "--host", "0.0.0.0"]
|