-
-
Notifications
You must be signed in to change notification settings - Fork 751
Expand file tree
/
Copy pathDockerfile
More file actions
58 lines (48 loc) · 1.93 KB
/
Dockerfile
File metadata and controls
58 lines (48 loc) · 1.93 KB
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
56
57
58
# Use a specific Playwright base image for reproducibility
FROM mcr.microsoft.com/playwright:v1.52.0-noble
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
# Set non-root user early for security
RUN groupadd -r pptruser && useradd -r -g pptruser -G audio,video pptruser \
&& mkdir -p /home/pptruser/Downloads /codecept /tests \
&& chown -R pptruser:pptruser /home/pptruser /codecept /tests
# Install dependencies and set up Google Chrome repository
RUN apt-get update --allow-releaseinfo-change && apt-get install -y --no-install-recommends \
libgtk2.0-0 \
libxtst6 \
libxss1 \
libnss3 \
xvfb \
gnupg \
wget \
ca-certificates \
fonts-noto \
fonts-freefont-ttf \
&& wget --quiet -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor -o /etc/apt/keyrings/google-chrome.gpg \
&& echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/google-chrome.gpg] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list \
&& apt-get update \
&& apt-get install -y google-chrome-stable --no-install-recommends \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Copy project files
COPY . /codecept
# Install Node.js dependencies as non-root user
RUN runuser -u pptruser -- npm install --loglevel=warn --prefix /codecept
# Set working directory
WORKDIR /tests
RUN runuser -u pptruser -- npm install puppeteer@$(npm view puppeteer version)
RUN runuser -u pptruser -- npx puppeteer browsers install chrome
RUN runuser -u pptruser -- npx playwright install
RUN ln -s /codecept/bin/codecept.js /usr/local/bin/codeceptjs
# Verify Chrome installation
RUN google-chrome --version
# Environment variables
ENV CODECEPT_ARGS=""
ENV RUN_MULTIPLE=false
ENV NO_OF_WORKERS=""
ENV HOST=selenium
ENV NODE_ENV=production
# Switch to non-root user
USER pptruser
# Set entrypoint and command
ENTRYPOINT ["/codecept/docker/entrypoint"]
CMD ["bash", "/codecept/docker/run.sh"]