Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 34 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,46 @@ RUN groupadd --gid 1000 node \

WORKDIR /app

RUN apt update && apt install -y libcurl4-openssl-dev libglfw3-dev libuv1-dev libpng-dev libicu-dev libjpeg-turbo8-dev libwebp-dev xvfb x11-utils
RUN apt install -y clang git cmake ccache ninja-build pkg-config
# Combine update, install and cleanup steps to reduce layer size
RUN apt-get update && apt-get install -y \
libcurl4-openssl-dev \
libglfw3-dev \
libuv1-dev \
libpng-dev \
libicu-dev \
libjpeg-turbo8-dev \
libwebp-dev \
xvfb \
x11-utils \
clang \
git \
cmake \
ccache \
ninja-build \
pkg-config \
curl \
&& rm -rf /var/lib/apt/lists/*

COPY package*.json /app/
ENV NVM_DIR /usr/local/nvm
ENV NODE_VERSION v20.11.0
RUN mkdir -p /usr/local/nvm && apt-get update && echo "y" | apt-get install curl
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
RUN /bin/bash -c "source $NVM_DIR/nvm.sh && nvm install $NODE_VERSION && nvm use --delete-prefix $NODE_VERSION"

# Install nvm, node, npm and cleanup in a single RUN to reduce layer size
RUN mkdir -p $NVM_DIR \
&& curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash \
&& . $NVM_DIR/nvm.sh \
&& nvm install $NODE_VERSION \
&& nvm use --delete-prefix $NODE_VERSION \
&& npm install \
&& nvm cache clear

ENV NODE_PATH $NVM_DIR/versions/node/$NODE_VERSION/bin
ENV PATH $NODE_PATH:$PATH
RUN npm install
ENV DISPLAY=:99.0
RUN start-stop-daemon --start --pidfile ~/xvfb.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1024x768x24 -ac +extension GLX +render -noreset

# Start Xvfb in the background
RUN start-stop-daemon --start --pidfile /tmp/xvfb.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1024x768x24 -ac +extension GLX +render -noreset

COPY ./src/* /app/src/
COPY entrypoint.sh /app
COPY ./tests/ /app/tests/
Expand Down