Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI] Add Dockerfiles linter - hadolint #1253

Merged
merged 2 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions .github/docker/ubuntu-22.04.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2023 Intel Corporation
# Copyright (C) 2023-2024 Intel Corporation
# Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions.
# See LICENSE.TXT
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Expand Down Expand Up @@ -51,20 +51,23 @@ RUN apt-get update \
${BASE_DEPS} \
${UR_DEPS} \
${MISC_DEPS} \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean all

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

# Install DPC++
COPY install_dpcpp.sh install_dpcpp.sh
COPY install_dpcpp.sh /opt/install_dpcpp.sh
ENV DPCPP_PATH=/opt/dpcpp
RUN ./install_dpcpp.sh
RUN /opt/install_dpcpp.sh

# Install libbacktrace
COPY install_libbacktrace.sh install_libbacktrace.sh
RUN ./install_libbacktrace.sh
COPY install_libbacktrace.sh /opt/install_libbacktrace.sh
RUN /opt/install_libbacktrace.sh

# Add a new (non-root) 'user'
ENV USER user
ENV USERPASS pass
RUN useradd -m $USER -g sudo -p `mkpasswd $USERPASS`
RUN useradd -m "${USER}" -g sudo -p "$(mkpasswd ${USERPASS})"
34 changes: 34 additions & 0 deletions .github/workflows/hadolint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Runs linter for Docker files
name: Hadolint

on:
workflow_dispatch:
push:
pull_request:
paths:
- '.github/docker/*Dockerfile'
- '.github/workflows/hadolint.yml'

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read

jobs:
linux:
name: Hadolint
runs-on: ubuntu-latest

steps:
- name: Clone the git repo
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Run Hadolint
uses: hadolint/hadolint-action@54c9adbab1582c2ef04b2016b760714a4bfde3cf # v3.1.0
with:
recursive: true
dockerfile: ".github/docker/*Dockerfile"
# ignore pinning apt packages to versions
ignore: DL3008