Improved docker build speed
This commit is contained in:
31
Dockerfile
31
Dockerfile
@@ -2,14 +2,15 @@ FROM nvidia/cuda:12.2.0-runtime-ubuntu22.04 AS base
|
||||
RUN apt-get update && \
|
||||
apt-get upgrade -y && \
|
||||
apt install -y \
|
||||
python3-pip \
|
||||
curl \
|
||||
git \
|
||||
jq \
|
||||
python3-venv \
|
||||
wget \
|
||||
gnupg \
|
||||
jq \
|
||||
python3-pip \
|
||||
python3-venv \
|
||||
tmux \
|
||||
vim \
|
||||
curl
|
||||
wget
|
||||
|
||||
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
|
||||
RUN echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list
|
||||
@@ -56,22 +57,26 @@ RUN rm -rf *.egg-info/
|
||||
FROM base AS sia-env
|
||||
RUN python3 -m venv /root/venvs/sia
|
||||
COPY ./setup.py /root/sia/setup.py
|
||||
COPY ./lib /root/sia/lib
|
||||
RUN /root/venvs/sia/bin/python /root/sia/setup.py egg_info
|
||||
RUN sed -i '/\/root\/sia\/lib/d' *.egg-info/requires.txt
|
||||
RUN --mount=type=cache,target=/root/.cache/pip \
|
||||
/root/venvs/sia/bin/pip install -r *.egg-info/requires.txt
|
||||
RUN rm -rf *.egg-info/
|
||||
|
||||
COPY action_schema.xsd /root/sia/action_schema.xsd
|
||||
RUN mkdir -p /root/sia/lib/xml_schema_validator/src/
|
||||
|
||||
RUN --mount=type=cache,target=/root/.cache/pip \
|
||||
/root/venvs/sia/bin/pip install -e /root/sia/
|
||||
|
||||
# Web frontend build
|
||||
FROM base
|
||||
# AS web-build
|
||||
ENV NODE_VERSION=16.13.0
|
||||
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
|
||||
ENV NVM_DIR=/root/.nvm
|
||||
RUN . "$NVM_DIR/nvm.sh" && nvm install ${NODE_VERSION}
|
||||
RUN . "$NVM_DIR/nvm.sh" && nvm use v${NODE_VERSION}
|
||||
RUN . "$NVM_DIR/nvm.sh" && nvm alias default v${NODE_VERSION}
|
||||
ENV PATH="/root/.nvm/versions/node/v${NODE_VERSION}/bin/:${PATH}"
|
||||
|
||||
FROM node:20-alpine AS web-build
|
||||
WORKDIR /app
|
||||
COPY web/package*.json ./
|
||||
COPY web/package.json ./
|
||||
RUN npm install
|
||||
RUN rm -rf /root/.npm/_cacache
|
||||
COPY web .
|
||||
|
||||
Reference in New Issue
Block a user