mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 12:37:53 +00:00
+42
-12
@@ -1,15 +1,45 @@
|
||||
FROM node:14 as build
|
||||
WORKDIR /app
|
||||
COPY ./package*.json /app/
|
||||
RUN npm config set unsafe-perm true
|
||||
RUN npm install -g ionic
|
||||
RUN npm config set legacy-peer-deps true
|
||||
RUN npm i -D typescript@4.3.5
|
||||
RUN npm install --save --legacy-peer-deps
|
||||
COPY ./ /app/
|
||||
RUN ionic build --prod
|
||||
# =========================
|
||||
# BUILD STAGE
|
||||
# =========================
|
||||
FROM node:16 AS build
|
||||
|
||||
FROM nginx:latest
|
||||
WORKDIR /app
|
||||
|
||||
# Avoid npm randomness
|
||||
ENV NPM_CONFIG_LEGACY_PEER_DEPS=true
|
||||
ENV NPM_CONFIG_AUDIT=false
|
||||
ENV NPM_CONFIG_FUND=false
|
||||
|
||||
# Copy dependency files first (better caching)
|
||||
COPY package*.json ./
|
||||
|
||||
# Clean install (IMPORTANT: single install only)
|
||||
RUN npm cache clean --force
|
||||
RUN npm install --legacy-peer-deps --no-audit --no-fund
|
||||
|
||||
# Copy full project
|
||||
COPY . .
|
||||
|
||||
# Build Ionic Angular app
|
||||
RUN npx ionic build --configuration production
|
||||
|
||||
|
||||
# =========================
|
||||
# PRODUCTION STAGE (NGINX)
|
||||
# =========================
|
||||
FROM nginx:alpine
|
||||
|
||||
# Nginx config (optional but recommended for SPA routing)
|
||||
COPY ./nginx/default.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
# Clean default nginx files
|
||||
RUN rm -rf /usr/share/nginx/html/*
|
||||
COPY /www/ /usr/share/nginx/html/
|
||||
|
||||
# Copy build output from previous stage
|
||||
COPY --from=build /app/www /usr/share/nginx/html
|
||||
|
||||
# Expose port
|
||||
EXPOSE 80
|
||||
|
||||
# Start nginx
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
Reference in New Issue
Block a user