Spaces:
Sleeping
Sleeping
File size: 829 Bytes
829f956 efead7f 567ad9e afdd5d6 c95a2c9 7e33654 efead7f 5efb26b efead7f 5efb26b 2b10cb1 567ad9e afdd5d6 567ad9e 829f956 567ad9e e33a87f 567ad9e efead7f 567ad9e 5efb26b 567ad9e 5efb26b |
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 |
FROM node:20
# Create non-root user with a home directory
RUN groupadd -r appuser && useradd -m -r -g appuser appuser
# Set working directory
WORKDIR /usr/src/app
# Copy package files and install dependencies
COPY package*.json ./
RUN npm install
# Set environment variable so Playwright installs browsers in a directory we'll later assign to appuser
ENV PLAYWRIGHT_BROWSERS_PATH=/home/appuser/.cache/ms-playwright
# Install Playwright browsers and dependencies as root
RUN npx playwright install --with-deps && \
mkdir -p /home/appuser/.cache/ms-playwright && \
chown -R appuser:appuser /home/appuser/.cache/ms-playwright /usr/src/app
# Copy the rest of the application code
COPY . .
# Switch to the non-root user
USER appuser
# Expose the desired port and start the server
EXPOSE 7860
CMD ["node", "server.js"]
|