Skip to content

Commit 8e0ccb9

Browse files
committed
misc: Update Hadolint rules and clean dockerfiles
1 parent 5674a30 commit 8e0ccb9

7 files changed

Lines changed: 28 additions & 21 deletions

File tree

.github/workflows/lint.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
name: "Spellcheck everything"
4848
runs-on: ubuntu-latest
4949
steps:
50-
- uses: actions/checkout@v5
50+
- uses: actions/checkout@v6
5151
- name: Set up Python 3.10
5252
uses: actions/setup-python@v6
5353
with:
@@ -69,7 +69,7 @@ jobs:
6969
# #example-error-annotation-on-github-actions
7070
runs-on: ubuntu-latest
7171
steps:
72-
- uses: actions/checkout@v3
72+
- uses: actions/checkout@v6
7373
- name: Check workflow files
7474
uses: docker://rhysd/actionlint:latest
7575
with:
@@ -81,9 +81,9 @@ jobs:
8181
container:
8282
image: hadolint/hadolint:latest-alpine
8383
env:
84-
HADOLINT_IGNORE: "DL3005,DL3007,DL3008,DL3015,DL3059"
84+
HADOLINT_IGNORE: "DL3003,DL3004,DL3005,DL3007,DL3008,DL3009,DL3013,DL3015,DL3042,DL3059,SC2103,SC2046,SC2086"
8585
steps:
86-
- uses: actions/checkout@v3
86+
- uses: actions/checkout@v6
8787
- name: Lint dockerfiles inside hadolint container
8888
run: |
8989
for DOCKERFILE in docker/Dockerfile.*; \

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,4 @@ repos:
3333
rev: v2.12.0
3434
hooks:
3535
- id: hadolint-docker
36+
entry: -e HADOLINT_IGNORE=DL3003,DL3004,DL3005,DL3007,DL3008,DL3009,DL3013,DL3015,DL3042,DL3059,SC2103,SC2046,SC2086 ghcr.io/hadolint/hadolint hadolint

docker/Dockerfile.amd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ ENV PATH=$ROCM_HOME/bin:$PATH \
2828
LD_LIBRARY_PATH=$ROCM_HOME/lib:$ROCM_HOME/lib/llvm/lib:$LD_LIBRARY_PATH
2929

3030
# Until rocm base has it fixed
31-
RUN ln -s /opt/rocm/llvm/bin/offload-arch /opt/rocm/bin/offload-arch | echo "offload-arch already exis"
31+
RUN ln -s /opt/rocm/llvm/bin/offload-arch /opt/rocm/bin/offload-arch || echo "offload-arch already exists"
3232

3333
# Install UCX
3434
RUN cd /tmp/ \

docker/Dockerfile.cpu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ ENV PATH=${PATH}:/opt/openmpi/bin
5454
ENV LD_LIBRARY_PATH=/opt/openmpi/lib
5555

5656
# Cleanup
57-
RUN apt-get clean && apt-get autoclean && apt-get autoremove -y && rm -rf /var/lib/apt/lists/*
57+
RUN apt-get clean && apt-get autoclean && apt-get autoremove -y && rm -rf /var/lib/apt/lists/*
5858

5959
EXPOSE 8888
6060
CMD ["/bin/bash"]

docker/Dockerfile.devito

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ RUN python3 -m venv /venv && \
2121
ln -fs /app/nvtop/build/src/nvtop /venv/bin/nvtop
2222

2323
# Copy Devito
24-
ADD . /app/devito
24+
COPY . /app/devito
2525

2626
# Remove git files
2727
RUN rm -rf /app/devito/.git
@@ -30,7 +30,7 @@ RUN rm -rf /app/devito/.git
3030
RUN eval "$MPI4PY_FLAGS /venv/bin/pip install --no-cache-dir --verbose -r /app/devito/requirements-mpi.txt"
3131

3232
# Devito
33-
RUN /venv/bin/pip install --no-cache-dir -e /app/devito[extras,tests] && rm -rf ~/.cache/pip
33+
RUN /venv/bin/pip install --no-cache-dir -e "/app/devito[extras,tests]" && rm -rf ~/.cache/pip
3434

3535
FROM $base AS utilities
3636

@@ -80,10 +80,10 @@ RUN groupadd -g ${GROUP_ID} app && \
8080
COPY --from=builder --chown=app:app /app /app
8181
COPY --from=utilities --chown=app:app /app/nvtop /app/nvtop
8282

83-
ADD --chown=app:app docker/run-jupyter.sh /jupyter
84-
ADD --chown=app:app docker/run-tests.sh /tests
85-
ADD --chown=app:app docker/run-print-defaults.sh /print-defaults
86-
ADD --chown=app:app docker/entrypoint.sh /docker-entrypoint.sh
83+
COPY --chown=app:app docker/run-jupyter.sh /jupyter
84+
COPY --chown=app:app docker/run-tests.sh /tests
85+
COPY --chown=app:app docker/run-print-defaults.sh /print-defaults
86+
COPY --chown=app:app docker/entrypoint.sh /docker-entrypoint.sh
8787
RUN chmod +x /print-defaults /jupyter /tests /docker-entrypoint.sh
8888

8989
# Venv

docker/Dockerfile.intel

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ FROM base AS oneapi
2626

2727
# Download the key to system keyring
2828
# https://www.intel.com/content/www/us/en/develop/documentation/installation-guide-for-intel-oneapi-toolkits-linux/top/installation/install-using-package-managers/apt.html#apt
29-
RUN wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor > /usr/share/keyrings/oneapi-archive-keyring.gpg
29+
SHELL /bin/bash -o pipefail
30+
RUN wget --progress=dot:giga -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor > /usr/share/keyrings/oneapi-archive-keyring.gpg
3031
RUN echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" > /etc/apt/sources.list.d/oneAPI.list
3132

3233
# Intel advisor and drivers
@@ -36,6 +37,7 @@ RUN apt-get update -y && \
3637

3738
# Drivers mandatory for intel gpu
3839
# https://dgpu-docs.intel.com/driver/installation.html#ubuntu-install-steps
40+
SHELL /bin/bash -o pipefail
3941
RUN wget -qO - https://repositories.intel.com/graphics/intel-graphics.key | gpg --dearmor > /usr/share/keyrings/intel-graphics.gpg
4042
RUN echo "deb [arch=amd64 signed-by=/usr/share/keyrings/intel-graphics.gpg] https://repositories.intel.com/graphics/ubuntu jammy unified" > /etc/apt/sources.list.d/intel-gpu-jammy.list
4143

docker/Dockerfile.nvidia

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ ENV DEBIAN_FRONTEND=noninteractive
1515

1616
# Install python
1717
RUN apt-get update && \
18-
apt-get install -y -q gpg apt-utils curl wget libnuma-dev cmake git \
18+
apt-get install -y -q gpg apt-utils curl libnuma-dev cmake git \
1919
dh-autoreconf python3-venv python3-dev python3-pip
2020

2121
# nodesource: nvdashboard requires nodejs>=10
22+
SHELL /bin/bash -o pipefail
2223
RUN curl https://developer.download.nvidia.com/hpc-sdk/ubuntu/DEB-GPG-KEY-NVIDIA-HPC-SDK | gpg --yes --dearmor -o /usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg
2324
RUN arch="$(uname -m)" && \
2425
case "$arch" in \
@@ -27,9 +28,9 @@ RUN arch="$(uname -m)" && \
2728
*) echo "Unsupported architecture: $arch" >&2; exit 1 ;; \
2829
esac && \
2930
echo "deb [trusted=yes, signed-by=/usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg] https://developer.download.nvidia.com/hpc-sdk/ubuntu/${nvplat} /" | tee /etc/apt/sources.list.d/nvhpc.list
30-
RUN apt-key update *&& apt-get update -y
31+
RUN apt-key update -- * && apt-get update -y
3132

32-
# Install nvhpc. `nvhpc` is the alias for the latest avaialble version
33+
# Install nvhpc. `nvhpc` is the alias for the latest available version
3334
ARG ver=nvhpc
3435
# We use the standard apt-get for the default latest nvhpc. For earlier version, apt has a bug that it will always
3536
# install the latest nvhpc-x-y no matter which version nvhpc-x-z is requested which would double (extra 10Gb) the size of the image.
@@ -43,10 +44,12 @@ RUN arch="$(uname -m)" && \
4344
if [ "$ver" = "nvhpc" ]; then \
4445
apt-get install -y -q --allow-unauthenticated ${ver}; \
4546
else \
46-
export year=$(echo $ver | cut -d "-" -f 2) && \
47-
export minor=$(echo $ver | cut -d "-" -f 3) && \
48-
wget -O nvhpc.deb "https://developer.download.nvidia.com/hpc-sdk/ubuntu/${nvplat}/nvhpc_${year}.${minor}_${nvplat}.deb" \
49-
|| wget -O nvhpc.deb "https://developer.download.nvidia.com/hpc-sdk/ubuntu/${nvplat}/nvhpc_${year}.${minor}-0_${nvplat}.deb" && \
47+
year=$(echo $ver | cut -d "-" -f 2) && \
48+
export year && \
49+
minor=$(echo $ver | cut -d "-" -f 3) && \
50+
export minor && \
51+
curl -O nvhpc.deb -L "https://developer.download.nvidia.com/hpc-sdk/ubuntu/${nvplat}/nvhpc_${year}.${minor}_${nvplat}.deb" \
52+
|| curl -O nvhpc.deb -L "https://developer.download.nvidia.com/hpc-sdk/ubuntu/${nvplat}/nvhpc_${year}.${minor}-0_${nvplat}.deb" && \
5053
apt-get install --allow-unauthenticated -y -q ./nvhpc.deb; \
5154
fi;
5255

@@ -89,6 +92,7 @@ ENV UCX_TLS=cuda,cuda_copy,cuda_ipc,sm,shm,self
8992
#ENV UCX_TLS=cuda,cuda_copy,cuda_ipc,sm,shm,self,rc_x,gdr_copy
9093

9194
# Make simlink for path setup since ENV doesn't accept shell commands.
95+
SHELL /bin/bash -o pipefail
9296
RUN arch="$(uname -m)" && \
9397
case "$arch" in \
9498
x86_64) linux=Linux_x86_64 ;; \
@@ -157,7 +161,7 @@ CMD ["/bin/bash"]
157161
FROM sdk-base AS nvc
158162

159163
# Make devito env vars file and extras
160-
ADD docker/nvdashboard.json /app/nvdashboard.json
164+
COPY docker/nvdashboard.json /app/nvdashboard.json
161165

162166
# mpi4py
163167
ENV MPI4PY_FLAGS='source $HPCSDK_HOME/comm_libs/hpcx/latest/hpcx-init.sh && hpcx_load && CC=nvc CFLAGS="-noswitcherror -tp=px"'

0 commit comments

Comments
 (0)