diff --git a/.github/workflows/hadolint.yml b/.github/workflows/hadolint.yml new file mode 100644 index 0000000..53522ba --- /dev/null +++ b/.github/workflows/hadolint.yml @@ -0,0 +1,34 @@ +name: Hadolint + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: hadolint/hadolint-action@v3.1.0 + with: + dockerfile: Dockerfile + - name: Update Pull Request + uses: actions/github-script@v6 + # if: github.event_name == 'pull_request' + with: + script: | + const output = ` + #### Hadolint: \`${{ steps.hadolint.outcome }}\` + \`\`\` + ${process.env.HADOLINT_RESULTS} + \`\`\` + `; + + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: output + }) \ No newline at end of file diff --git a/.hadolint.yml b/.hadolint.yml new file mode 100644 index 0000000..0da3071 --- /dev/null +++ b/.hadolint.yml @@ -0,0 +1,9 @@ +# Hadolint configuration file + +# configure ignore rules +# see https://github.com/hadolint/hadolint#rules for a list of available rules. +ignored: + - DL3018 + - DL3042 + - DL3013 + - DL3059 # multi run diff --git a/Dockerfile b/Dockerfile index 2294387..8188ac6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,10 +5,10 @@ LABEL "com.github.actions.description"="Run pylint and other commands" LABEL "com.github.actions.icon"="upload-cloud" LABEL "com.github.actions.color"="green" -RUN apk add --no-cache bash build-base gcc -RUN pip install --upgrade pip -RUN pip install pylint pipenv -RUN python --version ; pip --version ; pylint --version +RUN apk add --no-cache bash build-base gcc && \ +pip install --upgrade pip && \ +pip install pylint pipenv && \ +python --version ; pip --version ; pylint --version COPY entrypoint.sh / RUN chmod +x /entrypoint.sh