Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
shink committed Jun 19, 2024
1 parent 32d1ff5 commit 07105db
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
12 changes: 5 additions & 7 deletions cann/openeuler/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# Arguments
ARG BASE_VERSION=latest
ARG TARGETPLATFORM
ARG PLATFORM=${TARGETPLATFORM}
ARG CANN_CHIP
ARG CANN_VERSION

# Phase 1: download CANN installers
FROM alpine as downloader

ARG PLATFORM
ARG CANN_CHIP
ARG CANN_VERSION

RUN apk add --no-cache \
bash \
curl \
Expand All @@ -18,9 +22,6 @@ COPY ../scripts/cann.sh /tmp/cann.sh

# Download CANN
RUN chmod +x /tmp/cann.sh && \
PLATFORM=${TARGETPLATFORM} \
CANN_CHIP=${CANN_CHIP} \
CANN_VERSION=${CANN_VERSION} \
bash /tmp/cann.sh --download

# Phase 2: install CANN toolkit and kernels
Expand Down Expand Up @@ -53,9 +54,6 @@ RUN yum install -y \
RUN --mount=type=cache,from=downloader,target=/tmp,source=/tmp \
umask 0022 && \
chmod +x /tmp/cann.sh && \
PLATFORM=${TARGETPLATFORM} \
CANN_CHIP=${CANN_CHIP} \
CANN_VERSION=${CANN_VERSION} \
bash /tmp/cann.sh --install && \
rm -rf /tmp/*

Expand Down
24 changes: 13 additions & 11 deletions cann/ubuntu/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# Arguments
ARG BASE_VERSION=latest
ARG TARGETPLATFORM
ARG PLATFORM=${TARGETPLATFORM}
ARG CANN_CHIP
ARG CANN_VERSION

# Phase 1: download CANN installers
FROM alpine as downloader

ARG PLATFORM
ARG CANN_CHIP
ARG CANN_VERSION

RUN apk add --no-cache \
bash \
curl \
Expand All @@ -18,14 +22,15 @@ COPY ../scripts/cann.sh /tmp/cann.sh

# Download CANN
RUN chmod +x /tmp/cann.sh && \
PLATFORM=${TARGETPLATFORM} \
CANN_CHIP=${CANN_CHIP} \
CANN_VERSION=${CANN_VERSION} \
bash /tmp/cann.sh --download

# Phase 2: install CANN toolkit and kernels
FROM ubuntu:${BASE_VERSION} as builder

ARG PLATFORM
ARG CANN_CHIP
ARG CANN_VERSION

# Change the default shell
SHELL [ "/bin/bash", "-c" ]

Expand Down Expand Up @@ -61,18 +66,15 @@ RUN apt-get update \
python3-pip \
python3-dev \
vim \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /var/tmp/* \
&& rm -rf /tmp/*
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /var/tmp/* \
&& rm -rf /tmp/*

# Install CANN
RUN --mount=type=cache,from=downloader,target=/tmp,source=/tmp \
umask 0022 && \
chmod +x /tmp/cann.sh && \
PLATFORM=${TARGETPLATFORM} \
CANN_CHIP=${CANN_CHIP} \
CANN_VERSION=${CANN_VERSION} \
bash /tmp/cann.sh --install && \
rm -rf /tmp/*

Expand Down

0 comments on commit 07105db

Please sign in to comment.