Skip to content

Commit 8007b22

Browse files
authored
Merge pull request #1253 from lukaszstolarczuk/hadolint
[CI] Add Dockerfiles linter - hadolint
2 parents b51dec0 + d08237c commit 8007b22

File tree

2 files changed

+44
-7
lines changed

2 files changed

+44
-7
lines changed

.github/docker/ubuntu-22.04.Dockerfile

+10-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (C) 2023 Intel Corporation
1+
# Copyright (C) 2023-2024 Intel Corporation
22
# Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions.
33
# See LICENSE.TXT
44
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
@@ -51,20 +51,23 @@ RUN apt-get update \
5151
${BASE_DEPS} \
5252
${UR_DEPS} \
5353
${MISC_DEPS} \
54+
&& rm -rf /var/lib/apt/lists/* \
5455
&& apt-get clean all
5556

56-
RUN pip3 install ${UR_PYTHON_DEPS}
57+
# pip package is pinned to a version, but it's probably improperly parsed here
58+
# hadolint ignore=DL3013
59+
RUN pip3 install --no-cache-dir ${UR_PYTHON_DEPS}
5760

5861
# Install DPC++
59-
COPY install_dpcpp.sh install_dpcpp.sh
62+
COPY install_dpcpp.sh /opt/install_dpcpp.sh
6063
ENV DPCPP_PATH=/opt/dpcpp
61-
RUN ./install_dpcpp.sh
64+
RUN /opt/install_dpcpp.sh
6265

6366
# Install libbacktrace
64-
COPY install_libbacktrace.sh install_libbacktrace.sh
65-
RUN ./install_libbacktrace.sh
67+
COPY install_libbacktrace.sh /opt/install_libbacktrace.sh
68+
RUN /opt/install_libbacktrace.sh
6669

6770
# Add a new (non-root) 'user'
6871
ENV USER user
6972
ENV USERPASS pass
70-
RUN useradd -m $USER -g sudo -p `mkpasswd $USERPASS`
73+
RUN useradd -m "${USER}" -g sudo -p "$(mkpasswd ${USERPASS})"

.github/workflows/hadolint.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Runs linter for Docker files
2+
name: Hadolint
3+
4+
on:
5+
workflow_dispatch:
6+
push:
7+
pull_request:
8+
paths:
9+
- '.github/docker/*Dockerfile'
10+
- '.github/workflows/hadolint.yml'
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
14+
cancel-in-progress: true
15+
16+
permissions:
17+
contents: read
18+
19+
jobs:
20+
linux:
21+
name: Hadolint
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- name: Clone the git repo
26+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
27+
28+
- name: Run Hadolint
29+
uses: hadolint/hadolint-action@54c9adbab1582c2ef04b2016b760714a4bfde3cf # v3.1.0
30+
with:
31+
recursive: true
32+
dockerfile: ".github/docker/*Dockerfile"
33+
# ignore pinning apt packages to versions
34+
ignore: DL3008

0 commit comments

Comments
 (0)