-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathDockerfile-debian
More file actions
61 lines (49 loc) · 1.89 KB
/
Copy pathDockerfile-debian
File metadata and controls
61 lines (49 loc) · 1.89 KB
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
# -*- coding: utf-8 -*-
## ARGs
ARG PACKAGE_ROOT=nv/
## Stage 0: Build dashboard-ui (Node)
FROM node:20-alpine AS dashboard-builder
WORKDIR /app
# Install only deps first for better caching
COPY ./dashboard-ui/package.json ./dashboard-ui/package-lock.json ./
RUN npm ci
# Copy sources and build with workspace as CWD
COPY ./dashboard-ui ./
RUN npm run build
## Stage 1: Install dependencies
FROM python:3.12.6
ARG PACKAGE_ROOT=nv/
# Create temporary workspace
RUN mkdir -p /tmp/build/wheelhouse/
WORKDIR /tmp/build/
# Install Python packages required by the build process and display contents (for CI build convenience)
COPY ./poetry.lock ./poetry.toml ./pyproject.toml ./README.md ./
COPY ./${PACKAGE_ROOT} ./${PACKAGE_ROOT}
# Bring in built dashboard assets into the Python package tree
RUN mkdir -p /tmp/build/nv/svc/farm/services/dashboard/build
COPY --from=dashboard-builder /app/dist/ /tmp/build/nv/svc/farm/services/dashboard/build/
RUN pip install --upgrade pip poetry && \
poetry install --without dev && \
poetry show
# Build the wheel
RUN poetry build --format wheel
# Stage 2: Final image
FROM python:3.12-slim
ARG PIP_INDEX_URL=https://pypi.org/simple
ARG PIP_EXTRA_INDEX_URL=https://pypi.org/simple
LABEL MAINTAINER="agrapsas@nvidia.com"
# Python application installation
WORKDIR /app/
# Install the wheel(s)
COPY --from=0 /tmp/build/dist/* ./
RUN pip install -i ${PIP_INDEX_URL} --extra-index-url ${PIP_EXTRA_INDEX_URL} *.whl && \
rm -f *.whl
# Add curl for use in load_job_definitions.sh
RUN apt update \
&& DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends \
curl \
&& apt -y autoremove \
&& apt clean autoclean \
&& rm -rf /var/lib/apt/lists/*
RUN useradd -ms /bin/bash omniverse
USER omniverse