-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathe2e-tests.Dockerfile
99 lines (79 loc) · 2.75 KB
/
e2e-tests.Dockerfile
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
## DEVELOPERS NOTE:
## This Dockerfile must be run with the --cap-add=SYS_ADMIN option to ensure proper functionality.
ARG DEBIAN_VERSION=bookworm
ARG NODE_VERSION=20
## Use a builder
##
FROM node:${NODE_VERSION}-${DEBIAN_VERSION}-slim as builder
LABEL maintainer="[email protected]"
COPY . /opt/kalisio
# Setting environment variables
ARG APP
ARG NODE_APP_INSTANCE
ARG SUBDOMAIN
ARG HEADLESS
ENV APP=$APP
ENV NODE_APP_INSTANCE=$NODE_APP_INSTANCE
ENV SUBDOMAIN=$SUBDOMAIN
ENV HEADLESS=$HEADLESS
# Development environment setup
WORKDIR /opt/kalisio/
RUN \
cd /opt/kalisio/kdk && yarn && yarn link --link-folder /opt/kalisio/yarn-links && \
cd /opt/kalisio/$APP && yarn && yarn link "@kalisio/kdk" --link-folder /opt/kalisio/yarn-links
## Copy to final container
##
FROM node:${NODE_VERSION}-${DEBIAN_VERSION}-slim
LABEL maintainer="[email protected]"
# Setting environment variables
ARG APP
ARG NODE_APP_INSTANCE
ARG SUBDOMAIN
ARG HEADLESS
ENV APP=$APP
ENV NODE_APP_INSTANCE=$NODE_APP_INSTANCE
ENV SUBDOMAIN=$SUBDOMAIN
ENV HEADLESS=$HEADLESS
# Setup Puppeteer & Rclone and installation of the necessary packages
# https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md#running-puppeteer-in-docker
RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get update \
&& apt-get install -y wget gnupg curl zip unzip rclone \
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-get update \
&& apt-get install -y \
google-chrome-stable \
fonts-ipafont-gothic \
fonts-wqy-zenhei \
fonts-thai-tlwg \
fonts-kacst \
fonts-freefont-ttf \
libxss1 \
xorg \
xserver-xorg \
xvfb \
libx11-dev \
libxext-dev \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
# Copy Puppeteer cache from builder
COPY --from=Builder --chown=node:node /root/.cache/puppeteer /home/node/.cache/puppeteer
# Copy from builder
COPY --from=Builder --chown=node:node /opt/kalisio /opt/kalisio
# From now on, run stuff as 'node'
USER node
# Create the .config/rclone directory and set the necessary permissions
RUN mkdir -p /home/node/.config/rclone \
&& chown -R node:node /home/node/.config/rclone \
&& chmod -R 777 /home/node/.config/rclone
# Create /home/node/.local/bin/cc-test-reporter and set the necessary permissions
RUN mkdir -p /home/node/.local/bin/ \
&& touch /home/node/.local/bin/cc-test-reporter \
&& chmod 755 /home/node/.local/bin/cc-test-reporter
# Grant execute permissions
WORKDIR /opt/kalisio/$APP/scripts
RUN chmod +x run_e2e_test.sh
# Run tests
WORKDIR /opt/kalisio/$APP
CMD ["bash", "-c", "/opt/kalisio/$APP/scripts/run_e2e_test.sh $APP"]