Skip to content

Commit

Permalink
Addressing comments docker-dpu
Browse files Browse the repository at this point in the history
  • Loading branch information
shanshri committed Nov 28, 2023
1 parent 9c67332 commit e43b1fb
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 26 deletions.
2 changes: 1 addition & 1 deletion files/dsc/dpu.init
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function start_dpu()

docker ps -a --format "{{.ID}}\t{{.Image}}" | grep "docker-dpu:latest" | awk '{print $1}' | xargs -I {} docker rm {}

docker run -v $HOST_DIR/update:/update -v $HOST_DIR/sysconfig/config0:/sysconfig/config0 -v $HOST_DIR/sysconfig/config1:/sysconfig/config1 -v $HOST_DIR/obfl:/obfl -v $HOST_DIR/data:/data -v $HOST_DIR/tmpfsshare:/tmp -v $HOST_DIR/runfs:/run -v $HOST_DIR/logfs:/var/log -v /sys:/sys $NIC_MOUNT --net=host --name=docker-dpu --privileged docker-dpu:$TAG
docker run -v $HOST_DIR/update:/update -v $HOST_DIR/sysconfig/config0:/sysconfig/config0 -v $HOST_DIR/sysconfig/config1:/sysconfig/config1 -v $HOST_DIR/obfl:/obfl -v $HOST_DIR/data:/data -v $HOST_DIR/tmpfsshare:/tmp -v $HOST_DIR/runfs:/run -v $HOST_DIR/logfs:/var/log -v /sys:/sys $NIC_MOUNT --net=host --name=dpu --privileged docker-dpu:$TAG
}

case "$1" in
Expand Down
1 change: 0 additions & 1 deletion files/scripts/docker-dpu-base.sh

This file was deleted.

File renamed without changes.
File renamed without changes.
12 changes: 10 additions & 2 deletions platform/pensando/docker-dpu/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
# DOWNLOADED_DOCKER_IMAGES
FROM docker-dpu-base
# Auto-Generated for buildinfo
ARG SONIC_VERSION_CACHE
ARG SONIC_VERSION_CONTROL_COMPONENTS
COPY ["buildinfo", "/usr/local/share/buildinfo"]
COPY vcache/ /sonic/target/vcache/docker-dpu
ENV IMAGENAME=docker-dpu
ENV DISTRO=jessie
RUN pre_run_buildinfo docker-dpu

RUN echo "docker-dpu-base"

ENTRYPOINT ["/nic/tools/sysinit.sh", "classic", "hw", "30"]
RUN post_run_buildinfo docker-dpu

RUN post_run_cleanup docker-dpu
1 change: 1 addition & 0 deletions platform/pensando/rules.mk
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
include $(PLATFORM_PATH)/docker-dpu-base.mk
include $(PLATFORM_PATH)/docker-dpu.mk
include $(PLATFORM_PATH)/one-image.mk
include $(PLATFORM_PATH)/sdk.mk
Expand Down
25 changes: 3 additions & 22 deletions scripts/prepare_docker_buildinfo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,27 +55,14 @@ ENV IMAGENAME='${IMAGENAME}'
ENV DISTRO='${DISTRO}'
RUN pre_run_buildinfo '${IMAGENAME}'
'
DOWNLOADED_DOCKER_IMAGES_DOCKERFILE_PRE_SCRIPT='# Auto-Generated for buildinfo
ARG SONIC_VERSION_CACHE
ARG SONIC_VERSION_CONTROL_COMPONENTS
COPY ["buildinfo", "/usr/local/share/buildinfo"]
COPY vcache/ /sonic/target/vcache/'${IMAGENAME}'
COPY ["tmp_extract", "/"]
ENV IMAGENAME='${IMAGENAME}'
ENV DISTRO='${DISTRO}'
RUN pre_run_buildinfo '${IMAGENAME}'
'

# Add the auto-generate code if it is not added in the target Dockerfile
if [ ! -f $DOCKERFILE_TARGET ] || ! grep -q "Auto-Generated for buildinfo" $DOCKERFILE_TARGET; then
# Insert the docker build script before the RUN command
LINE_NUMBER=$(grep -Fn -m 1 'RUN' $DOCKERFILE | cut -d: -f1)
TEMP_FILE=$(mktemp)
if ! grep -q "DOWNLOADED_DOCKER_IMAGES" $DOCKERFILE_TARGET; then
awk -v text="${DOCKERFILE_PRE_SCRIPT}" -v linenumber=$LINE_NUMBER 'NR==linenumber{print text}1' $DOCKERFILE > $TEMP_FILE
else
awk -v text="${DOWNLOADED_DOCKER_IMAGES_DOCKERFILE_PRE_SCRIPT}" -v linenumber=$LINE_NUMBER 'NR==linenumber{print text}1' $DOCKERFILE > $TEMP_FILE
fi
awk -v text="${DOCKERFILE_PRE_SCRIPT}" -v linenumber=$LINE_NUMBER 'NR==linenumber{print text}1' $DOCKERFILE > $TEMP_FILE

# Append the docker build script at the end of the docker file
echo -e "\nRUN post_run_buildinfo ${IMAGENAME} " >> $TEMP_FILE
echo -e "\nRUN post_run_cleanup ${IMAGENAME} " >> $TEMP_FILE
Expand All @@ -86,13 +73,7 @@ fi

# Copy the build info config
mkdir -p ${BUILDINFO_PATH}
if ! grep -q "DOWNLOADED_DOCKER_IMAGES" $DOCKERFILE_TARGET; then
cp -rf src/sonic-build-hooks/buildinfo/* $BUILDINFO_PATH
else
cp -rf src/sonic-build-hooks/buildinfo/* $BUILDINFO_PATH
mkdir -p $DOCKERFILE_PATH/tmp_extract
dpkg --extract $BUILDINFO_PATH/sonic-build-hooks_1.0_all.deb $DOCKERFILE_PATH/tmp_extract
fi
cp -rf src/sonic-build-hooks/buildinfo/* $BUILDINFO_PATH

# Generate the version lock files
scripts/versions_manager.py generate -t "$BUILDINFO_VERSION_PATH" -n "$IMAGENAME" -d "$DISTRO" -a "$ARCH"
Expand Down

0 comments on commit e43b1fb

Please sign in to comment.