Spaces:
Sleeping
Sleeping
File size: 974 Bytes
20ea9ad | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | # Stage 1: Build the Vite application
FROM node:20-slim AS build
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
# Stage 2: Production image
FROM node:20-slim
RUN apt-get update && apt-get install -y \
chromium \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
# Set the environment to production
ENV NODE_ENV production
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
WORKDIR /app
# Ensure we have permissions
RUN mkdir -p /app/tokens && chown -R node:node /app
USER node
# Copy only the necessary files for running the app
COPY --from=build --chown=node /app/package*.json ./
COPY --from=build --chown=node /app/node_modules ./node_modules
COPY --from=build --chown=node /app/dist ./dist
COPY --from=build --chown=node /app/server.js ./server.js
# Expose the port required by Hugging Face
EXPOSE 7860
# The command to start our custom Node.js server
CMD ["node", "server.js"]
|