Initial commit
This commit is contained in:
34
frontend/Dockerfile
Normal file
34
frontend/Dockerfile
Normal file
@@ -0,0 +1,34 @@
|
||||
# Multi-stage build for Astro SSR
|
||||
FROM node:20-alpine AS base
|
||||
WORKDIR /app
|
||||
|
||||
# Install dependencies
|
||||
FROM base AS deps
|
||||
RUN apk add --no-cache git
|
||||
COPY package.json ./
|
||||
RUN npm install
|
||||
|
||||
# Build Astro
|
||||
FROM base AS builder
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
|
||||
# Production image
|
||||
FROM base AS runner
|
||||
ENV NODE_ENV=production
|
||||
ENV HOST=0.0.0.0
|
||||
ENV PORT=4321
|
||||
|
||||
# Copy built files and production dependencies
|
||||
COPY --from=builder /app/dist ./dist
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY package.json ./
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=10s --retries=3 --start-period=40s \
|
||||
CMD node -e "require('http').get('http://127.0.0.1:4321/', (r) => r.statusCode === 200 ? process.exit(0) : process.exit(1))"
|
||||
|
||||
EXPOSE 4321
|
||||
|
||||
CMD ["npm", "start"]
|
||||
Reference in New Issue
Block a user