File tree Expand file tree Collapse file tree 3 files changed +10
-6
lines changed
Expand file tree Collapse file tree 3 files changed +10
-6
lines changed Original file line number Diff line number Diff line change 44# SPDX-License-Identifier: Apache-2.0
55
66# Specify DOCKER_IMAGE_MIRROR if you want to use a mirror of hub.docker.com
7- ARG PYTHON_IMAGE =python:3.12-slim
7+ ARG BASE_IMAGE =python:3.12-slim
88ARG DOCKER_IMAGE_MIRROR=""
99
1010# ============================
1111# Workshop
1212# ============================
13- FROM ${DOCKER_IMAGE_MIRROR}${PYTHON_IMAGE } AS workshop
13+ FROM ${DOCKER_IMAGE_MIRROR}${BASE_IMAGE } AS workshop
1414
1515ARG USERNAME
1616ARG TORCH_WHEEL
@@ -33,6 +33,7 @@ COPY --chown=$DOCKER_USER:$DOCKER_USER welcome.txt /home/$DOCKER_USER/welcome.tx
3333
3434# Switch to userland
3535USER $DOCKER_USER
36+ RUN echo "DOCKER_USER=${DOCKER_USER}"
3637WORKDIR /home/$DOCKER_USER
3738
3839# Create virtual environment
@@ -68,7 +69,7 @@ COPY --chown=$DOCKER_USER:$DOCKER_USER pytorch/test /home/$DOCKER_USER/pytorch/t
6869# ============================
6970# Final flat image
7071# ============================
71- FROM ${DOCKER_IMAGE_MIRROR}${PYTHON_IMAGE }
72+ FROM ${DOCKER_IMAGE_MIRROR}${BASE_IMAGE }
7273
7374ARG USERNAME
7475ENV DEBIAN_FRONTEND=noninteractive
Original file line number Diff line number Diff line change @@ -22,14 +22,17 @@ if ! [ -e "$1" ] || ! [ -e "$2" ]; then
2222 exit 1
2323fi
2424
25+ IMAGE_USERNAME=" ${USERNAME:- $(. / etc/ os-release && echo " $ID " )} "
26+ echo " USERNAME=$IMAGE_USERNAME "
27+
2528docker buildx \
2629 build --load \
2730 -t toolsolutions-pytorch:latest \
2831 --build-context rootdir=../.. \
2932 --build-arg DOCKER_IMAGE_MIRROR \
3033 --build-arg TORCH_WHEEL=$1 \
3134 --build-arg TORCH_AO_WHEEL=$2 \
32- --build-arg USERNAME=debian \
35+ --build-arg USERNAME=" $IMAGE_USERNAME " \
3336 .
3437
3538[[ $* == * --build-only* ]] && exit 0
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ function apply-github-patch {
5757
5858 # Approach #1: Try a simple patch application with 'git am'
5959 _git_with_credentials am --keep-cr " $patch_file " && return 0
60- git am --abort || true # wokeignore:rule=abort/terminate
60+ _git_with_credentials am --abort || true # wokeignore:rule=abort/terminate
6161
6262 # Approach #2: Try a three-way merge after fetching the parent commit. It can handle
6363 # scenarios in which the context of the patch has moved. However, we need the parent
@@ -68,7 +68,7 @@ function apply-github-patch {
6868 fi
6969 git fetch --no-tags --quiet --depth=2 " $fetch_url " " $2 " || true
7070 _git_with_credentials am --3way --keep-cr " $patch_file " && return 0
71- git am --abort || true # wokeignore:rule=abort/terminate
71+ _git_with_credentials am --abort || true # wokeignore:rule=abort/terminate
7272
7373 # Approach #3: Fall back to GNU 'patch'
7474 patch -p1 < " $patch_file " || return 1
You can’t perform that action at this time.
0 commit comments