tapp / index.html
flen-crypto's picture
Upload index.html with huggingface_hub
1596e3f verified
# -----------------------------------------------
# Multi-stage Dockerfile for a React + Vite PWA
# -----------------------------------------------
# 1) Build stage
FROM node:20-alpine AS build
WORKDIR /app
# Install global pnpm for faster installs
RUN corepack enable && corepack prepare pnpm@latest --activate
# Copy dependency manifests first for better layer caching
COPY package.json pnpm-lock.yaml ./
# Install all dependencies (including devDependencies for build)
RUN pnpm install --frozen-lockfile
# Copy source files
COPY . .
# Build the production bundle
RUN pnpm run build
# -----------------------------------------------
# 2) Runtime stage – tiny nginx image
# -----------------------------------------------
FROM nginx:1.25-alpine
# Copy built static assets from build stage
COPY --from=build /app/dist /usr/share/nginx/html
# Copy custom nginx config to serve SPA & PWA headers
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Allow nginx to bind to privileged ports as non-root
RUN touch /var/run/nginx.pid && \
chown -R nginx:nginx /var/run/nginx.pid /usr/share/nginx/html /var/cache/nginx
USER nginx
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]