File size: 2,334 Bytes
9e80488
 
57ae9f0
1ce0835
9e80488
bede174
dd76c65
7b88ff9
c2dc695
7b88ff9
6843a47
90ef48f
7b88ff9
 
 
dd76c65
7b88ff9
bede174
101f229
9e80488
bede174
9e80488
 
6ddaa1d
9e80488
 
9307755
9e80488
9307755
65ead1e
 
9e80488
0cdb42e
 
 
 
9e80488
9307755
3c52255
9e80488
 
ce90b14
7c4c74f
 
 
 
 
6e50b9c
dd76c65
5531ede
9e80488
3c52255
 
9e80488
 
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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" ]