deepcek / Dockerfile
deepak191z's picture
Update Dockerfile
567ad9e verified
raw
history blame contribute delete
829 Bytes
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"]