@@ -0,0 +1,17 @@
|
|||||||
|
node_modules
|
||||||
|
dist
|
||||||
|
coverage
|
||||||
|
.git
|
||||||
|
.github
|
||||||
|
.env
|
||||||
|
.env.*
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
.vscode
|
||||||
|
.idea
|
||||||
|
.DS_Store
|
||||||
|
*.md
|
||||||
|
Dockerfile*
|
||||||
|
docker-compose*
|
||||||
+32
-23
@@ -1,24 +1,33 @@
|
|||||||
FROM node:20-alpine AS builder
|
# -------- Build Stage --------
|
||||||
|
FROM node:20-alpine AS builder
|
||||||
|
|
||||||
# Install tzdata to support timezone settings
|
WORKDIR /app
|
||||||
RUN apk add --no-cache tzdata
|
|
||||||
|
# Copy only dependency files first (better cache)
|
||||||
# Set the timezone to Asia/Tehran
|
COPY package*.json ./
|
||||||
RUN cp /usr/share/zoneinfo/Asia/Tehran /etc/localtime && echo "Asia/Tehran" > /etc/timezone
|
|
||||||
|
# Use clean install for reproducible builds
|
||||||
WORKDIR /build
|
RUN npm ci
|
||||||
COPY package*.json ./
|
|
||||||
RUN npm install
|
# Copy source after deps (maximizes cache usage)
|
||||||
COPY . ./
|
COPY . .
|
||||||
RUN npm run build
|
|
||||||
|
# Build with production mode
|
||||||
FROM nginx:stable-alpine AS production-stage
|
RUN npm run build
|
||||||
|
|
||||||
COPY --from=builder /build/dist /usr/share/nginx/html
|
|
||||||
|
# -------- Production Stage --------
|
||||||
COPY --from=builder /build/nginx.con[f] /etc/nginx/conf.d/default.conf
|
FROM nginx:stable-alpine AS production
|
||||||
RUN cat /etc/nginx/conf.d/default.conf
|
|
||||||
|
# Copy built assets
|
||||||
EXPOSE 80
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||||
|
|
||||||
CMD ["nginx", "-g", "daemon off;"]
|
# Copy nginx config (optional, safer naming)
|
||||||
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
|
||||||
|
# Remove default nginx config if needed (optional safety)
|
||||||
|
RUN rm -f /etc/nginx/conf.d/default.conf.default || true
|
||||||
|
|
||||||
|
EXPOSE 80
|
||||||
|
|
||||||
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
Reference in New Issue
Block a user