-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfilechromium
57 lines (45 loc) · 1.85 KB
/
Dockerfilechromium
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
FROM node:lts-bookworm-slim
# procps - for access to ps command like pkill and pgrep
RUN apt-get update && apt-get install -y \
nano git curl php \
python3-pip udev build-essential \
chromium-driver chromium xvfb \
libssl-dev openssl \
procps \
&& rm -rf /var/lib/apt/lists/*
# fake chrome and force parameters
COPY bin/chromium.sh /tmp/chromium
RUN mv /usr/bin/chromium /usr/bin/chromium-original \
&& ln -sfv /tmp/chromium /usr/bin/chromium
RUN chmod +x /usr/bin/chromium
RUN ln -sf /usr/bin/chromium /usr/bin/google-chrome
# Set up environment for Chromium and Chromedriver
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \
CHROMIUM_PATH=/usr/bin/chromium \
CHROMEDRIVER_PATH=/usr/bin/chromedriver
# Download and install Micromamba
ENV MAMBA_ROOT_PREFIX=/opt/micromamba
RUN curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/latest | tar -xvj bin/micromamba && \
./bin/micromamba shell init -s bash -r $MAMBA_ROOT_PREFIX
RUN mkdir -p /opt/micromamba/envs && chmod 777 /opt/micromamba/envs
# Create a non-root user
RUN useradd -ms /bin/bash openiapuser
RUN mkdir -p /home/openiapuser/.mamba && \
chown -R openiapuser:openiapuser /home/openiapuser/.mamba
RUN apt-get update && apt-get install -y python-is-python3 && rm -rf /var/lib/apt/lists/*
USER openiapuser
WORKDIR /home/openiapuser
# Initialize Micromamba for the user
RUN echo 'eval "$(micromamba shell hook --shell=bash)"' >> ~/.bashrc
# Copy files with appropriate permissions
COPY --chown=openiapuser package.json package-lock.json ./
# Install NPM packages
RUN npm install --omit=dev --production --verbose
# Openshift hack
RUN chmod -R 777 /home/openiapuser
RUN rm -r /home/openiapuser/.npm/*
# Copy the rest of your application
COPY --chown=openiapuser . .
ENV HOME='/home/openiapuser'
ENV USER='openiapuser'
CMD ["node", "--require", "./dist/Logger.js", "dist/runagent.js"]