Focus on production only
This commit is contained in:
parent
c53cf2e10c
commit
98e5dc568a
1 changed files with 4 additions and 13 deletions
17
Dockerfile
17
Dockerfile
|
|
@ -1,32 +1,23 @@
|
||||||
# Build stage
|
# Build stage
|
||||||
FROM --platform=linux/amd64 node:20-alpine as build
|
FROM --platform=linux/amd64 node:20-alpine as build
|
||||||
ARG NODE_ENV=production
|
|
||||||
ENV NODE_ENV=${NODE_ENV}
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# System dependencies with enhanced build tools
|
# Essential build dependencies only
|
||||||
RUN apk add --no-cache python3 make g++ curl git libc6-compat
|
RUN apk add --no-cache python3 make g++ curl git libc6-compat
|
||||||
|
|
||||||
# Clean and prepare npm
|
|
||||||
RUN npm cache clean --force
|
|
||||||
RUN npm install -g npm@latest
|
|
||||||
|
|
||||||
# Install dependencies from package.json
|
# Install dependencies from package.json
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
RUN npm ci && npm audit fix --force
|
RUN npm ci
|
||||||
RUN npm install -g typescript
|
RUN npm install -g typescript
|
||||||
|
|
||||||
# Copy source code and build
|
# Build production assets
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
# Production stage with Nginx
|
# Production stage - static files only
|
||||||
FROM nginx:alpine
|
FROM nginx:alpine
|
||||||
COPY --from=build /app/dist /usr/share/nginx/html
|
COPY --from=build /app/dist /usr/share/nginx/html
|
||||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
|
||||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
|
||||||
CMD curl -f http://localhost/ || exit 1
|
|
||||||
|
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
CMD ["nginx", "-g", "daemon off;"]
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue