-
-
Notifications
You must be signed in to change notification settings - Fork 141
/
Dockerfile
63 lines (52 loc) · 1.54 KB
/
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
# https://hub.docker.com/_/node
FROM node:lts-bullseye-slim
# install dependencies of Chrome binary that will be fetched by npm ci
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
fonts-liberation \
libasound2 \
libatk-bridge2.0-0 \
libatk1.0-0 \
libatspi2.0-0 \
libc6 \
libcairo2 \
libcups2 \
libdbus-1-3 \
libfreetype6 \
libgbm1 \
libharfbuzz0b \
libnss3 \
libpango-1.0-0 \
libx11-6 \
libxext6 \
libxkbcommon0 \
x11-utils \
xdg-utils \
zlib1g \
&& rm -rf /var/lib/apt/lists/*
# Set up a working directory
ENV HOME /opt/phantomas
WORKDIR $HOME
RUN chown -R nobody:nogroup .
# Run everything after as non-privileged user.
USER nobody
ENV DOCKERIZED yes
# Install dependencies
COPY package.json .
COPY package-lock.json .
RUN npm ci
# find the chrome binary and symlink it to the PATH
# e.g. ./.cache/puppeteer/chrome/linux-112.0.5615.121/chrome-linux64/chrome
RUN echo "Chrome found in: " $(find . -wholename '*chrome-linux64/chrome') && \
ln -s $(find . -wholename '*chrome-linux64/chrome') .
ENV PATH ${PATH}":/opt/phantomas"
RUN ldd chrome && \
chrome --version
ARG GITHUB_SHA="dev"
ENV COMMIT_SHA ${GITHUB_SHA}
# label the image with branch name and commit hash
LABEL maintainer="[email protected]"
LABEL org.opencontainers.image.source="https://github.com/macbre/phantomas"
LABEL org.opencontainers.image.revision="${COMMIT_SHA}"
# Copy the content of the rest of the repository into a container
COPY . .