44 lines
1.1 KiB
Docker
44 lines
1.1 KiB
Docker
# Use the official Playwright image as base
|
|
FROM mcr.microsoft.com/playwright:v1.42.1-jammy
|
|
|
|
# Set the working directory
|
|
WORKDIR /app
|
|
|
|
# Install Python and Node.js (for both Python and JS examples)
|
|
# RUN apt-get update && \
|
|
# apt-get install -y python3 python3-pip && \
|
|
# rm -rf /var/lib/apt/lists/*
|
|
RUN apt-get update && \
|
|
apt-get install -y \
|
|
python3 \
|
|
python3-pip \
|
|
xvfb \
|
|
x11-utils \
|
|
libgtk-3-0 \
|
|
libnotify-dev \
|
|
libgconf-2-4 \
|
|
libnss3 \
|
|
libxss1 \
|
|
libasound2 \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
# Copy package files first to leverage Docker cache
|
|
COPY package.json requirements.txt ./
|
|
|
|
# Install Node.js and Python dependencies
|
|
RUN npm install && \
|
|
pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Install Playwright browsers
|
|
RUN npx playwright install --with-deps
|
|
|
|
# Copy the rest of the application
|
|
|
|
COPY . .
|
|
|
|
# Make our scripts executable
|
|
RUN chmod +x ./run*.sh
|
|
|
|
# Set default command to display help
|
|
# CMD ["bash", "-c", "echo 'Choose a script: run_python.sh or run_node.sh' && bash"]
|
|
CMD ["xvfb-run", "bash", "-c", "echo 'Choose a script: run_python.sh or run_node.sh' && bash"]
|