Spaces:
Sleeping
Sleeping
FROM node:18-slim | |
# Install ffmpeg, ca-certificates, and other useful tools for SSL support | |
RUN apt-get update && apt-get install -y --no-install-recommends ffmpeg curl ca-certificates wget unzip file && \ | |
apt-get clean && rm -rf /var/lib/apt/lists/* | |
# Rhubarb installation has been removed. | |
USER node | |
# The microsoft-cognitiveservices-speech-sdk will now be installed via package.json and npm ci | |
# Diagnostic commands for the node user | |
RUN echo "Running diagnostics as $(whoami)" | |
RUN echo "PATH is: $PATH" | |
# Removed: RUN which rhubarb || echo "rhubarb not found in PATH for node user during build" | |
# Set environment variables | |
ENV NODE_ENV=production | |
ENV PORT=7860 | |
# Create app directory and set it as working directory | |
WORKDIR /home/node/app | |
# Copy package.json and package-lock.json (or yarn.lock) first | |
# This allows Docker to cache the npm install step if these files don't change | |
COPY --chown=node:node backend/package.json backend/package-lock.json* ./ | |
# If you use yarn, uncomment the next line and comment out the npm ci line | |
# COPY --chown=node:node backend/package.json backend/yarn.lock ./ | |
# Install dependencies | |
# Using npm ci for cleaner installs if package-lock.json is present | |
# RUN npm ci --only=production | |
# Switching to npm install --omit=dev to resolve package-lock.json sync issues during Docker build. | |
# Ideally, package-lock.json should be updated locally by running `npm install` in the backend directory and committing the result. | |
RUN npm install --omit=dev | |
# If you use yarn, uncomment the next line and comment out the npm ci line | |
# RUN yarn install --production --frozen-lockfile | |
# Copy the rest of the application files from the backend directory | |
COPY --chown=node:node backend/ ./ | |
# Create audios and public directories explicitly to avoid ENOENT errors | |
RUN mkdir -p /home/node/app/audios /home/node/app/public | |
# Optionally, create a placeholder index.html if no static files are copied | |
# This prevents ENOENT errors when serving index.html | |
RUN echo '<html><body><h1>Placeholder for Virtual Girlfriend App</h1><p>This is a placeholder page. Update with actual content if needed.</p></body></html>' > /home/node/app/public/index.html | |
# Rhubarb download/installation section removed. | |
# Expose the port the app runs on | |
EXPOSE 7860 | |
# Command to run the application | |
CMD [ "node", "index.js" ] |