2020-12-16 13:31:39 -05:00
|
|
|
name: Hadolint
|
|
|
|
|
2022-09-15 10:51:52 -04:00
|
|
|
on: [
|
|
|
|
push,
|
|
|
|
pull_request
|
|
|
|
]
|
2020-12-16 13:31:39 -05:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
hadolint:
|
|
|
|
name: Validate Dockerfile syntax
|
2024-08-13 06:52:07 -04:00
|
|
|
runs-on: ubuntu-24.04
|
2022-12-15 11:15:48 -05:00
|
|
|
timeout-minutes: 30
|
2020-12-16 13:31:39 -05:00
|
|
|
steps:
|
|
|
|
# Checkout the repo
|
|
|
|
- name: Checkout
|
2024-10-11 12:42:40 -04:00
|
|
|
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 #v4.2.1
|
2020-12-16 13:31:39 -05:00
|
|
|
# End Checkout the repo
|
|
|
|
|
2024-08-13 06:52:07 -04:00
|
|
|
# Start Docker Buildx
|
|
|
|
- name: Setup Docker Buildx
|
2024-10-11 12:42:40 -04:00
|
|
|
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1
|
2024-08-13 06:52:07 -04:00
|
|
|
# https://github.com/moby/buildkit/issues/3969
|
|
|
|
# Also set max parallelism to 2, the default of 4 breaks GitHub Actions and causes OOMKills
|
|
|
|
with:
|
|
|
|
buildkitd-config-inline: |
|
|
|
|
[worker.oci]
|
|
|
|
max-parallelism = 2
|
|
|
|
driver-opts: |
|
|
|
|
network=host
|
|
|
|
|
2022-05-04 15:13:05 -04:00
|
|
|
# Download hadolint - https://github.com/hadolint/hadolint/releases
|
2020-12-16 13:31:39 -05:00
|
|
|
- name: Download hadolint
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2021-06-19 13:22:19 -04:00
|
|
|
sudo curl -L https://github.com/hadolint/hadolint/releases/download/v${HADOLINT_VERSION}/hadolint-$(uname -s)-$(uname -m) -o /usr/local/bin/hadolint && \
|
2020-12-16 13:31:39 -05:00
|
|
|
sudo chmod +x /usr/local/bin/hadolint
|
|
|
|
env:
|
2022-12-15 11:15:48 -05:00
|
|
|
HADOLINT_VERSION: 2.12.0
|
2020-12-16 13:31:39 -05:00
|
|
|
# End Download hadolint
|
|
|
|
|
2024-08-13 06:52:07 -04:00
|
|
|
# Test Dockerfiles with hadolint
|
2020-12-16 13:31:39 -05:00
|
|
|
- name: Run hadolint
|
|
|
|
shell: bash
|
2023-10-22 18:18:38 -04:00
|
|
|
run: hadolint docker/Dockerfile.{debian,alpine}
|
2024-08-13 06:52:07 -04:00
|
|
|
# End Test Dockerfiles with hadolint
|
|
|
|
|
|
|
|
# Test Dockerfiles with docker build checks
|
|
|
|
- name: Run docker build check
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
echo "Checking docker/Dockerfile.debian"
|
|
|
|
docker build --check . -f docker/Dockerfile.debian
|
|
|
|
echo "Checking docker/Dockerfile.alpine"
|
|
|
|
docker build --check . -f docker/Dockerfile.alpine
|
|
|
|
# End Test Dockerfiles with docker build checks
|