Files

45 lines
980 B
Docker
Raw Permalink Normal View History

2026-04-14 10:55:34 +01:00
# =========================
# BUILD STAGE
# =========================
2026-04-14 11:14:39 +01:00
FROM node:16.20.2 AS build
2026-04-14 10:55:34 +01:00
2026-04-14 09:59:04 +01:00
WORKDIR /app
2026-04-14 10:55:34 +01:00
# 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)
2026-04-14 09:59:04 +01:00
COPY ./nginx/default.conf /etc/nginx/conf.d/default.conf
2026-04-14 10:55:34 +01:00
# Clean default nginx files
2026-04-14 09:59:04 +01:00
RUN rm -rf /usr/share/nginx/html/*
2026-04-14 10:55:34 +01:00
# 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;"]