Skip to content

Commit

Permalink
Enable Dockerfile linter tool (#200)
Browse files Browse the repository at this point in the history
* Improve e2e Dockerfile

Signed-off-by: Victor Morales <[email protected]>

* Use fixed distro less version image for generic autobumper

Signed-off-by: Victor Morales <[email protected]>

* Improve label_sync dockerfile

Signed-off-by: Victor Morales <[email protected]>

* Enable prow dockerfile lint job

---------

Signed-off-by: Victor Morales <[email protected]>
  • Loading branch information
electrocucaracha authored Oct 18, 2023
1 parent 1bebbdc commit 6d0a2db
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 13 deletions.
15 changes: 15 additions & 0 deletions .prow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,21 @@ presubmits:
args:
- "-c"
- set -eE; cd e2e/provision; /usr/local/bin/tox -e lint
- name: images-hadolint
annotations:
labels:
run_if_changed: '^images/'
skip_report: false
decorate: true
cluster: default
spec:
containers:
- image: "hadolint/hadolint:v2.12.0-debian"
command:
- "/bin/sh"
args:
- "-c"
- set -eE; for dockerfile in images/*/Dockerfile; do hadolint $dockerfile -t warning; done
- name: bootstrap-integration
annotations:
labels:
Expand Down
12 changes: 6 additions & 6 deletions images/e2e/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM hashicorp/terraform:1.4.5
RUN apk update && \
wget -c https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-427.0.0-linux-x86_64.tar.gz && \
tar xf /google-cloud-cli-427.0.0-linux-x86_64.tar.gz && \
apk add python3 && \
/google-cloud-sdk/install.sh -q
FROM hashicorp/terraform:1.5.7

SHELL ["/bin/ash", "-eo", "pipefail", "-c"]
RUN wget -q -c https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-446.0.0-linux-x86_64.tar.gz -O - | tar -xz -C /tmp && \
apk add --no-cache python3=3.11.5-r0 && \
/tmp/google-cloud-sdk/install.sh -q
2 changes: 1 addition & 1 deletion images/generic-autobumper/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ RUN git clone --depth 1 https://github.com/kubernetes/test-infra.git /opt/test-i
WORKDIR /opt/test-infra
RUN CGO_ENABLED=0 go build -o /tmp/ ./prow/cmd/generic-autobumper/...

FROM gcr.io/distroless/static-debian11
FROM gcr.io/distroless/static-debian11@sha256:6706c73aae2afaa8201d63cc3dda48753c09bcd6c300762251065c0f7e602b25

COPY --from=builder /tmp/generic-autobumper /
CMD ["/generic-autobumper"]
18 changes: 12 additions & 6 deletions images/label_sync/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
FROM golang:1.20.4-alpine3.17 as builder
RUN apk update && apk add git && cd src && \
git clone https://github.com/kubernetes/test-infra.git && \
cd test-infra/label_sync && \
go build

FROM golang:1.20.4-alpine3.17
COPY --from=builder /go/src/test-infra/label_sync/label_sync /go/bin
WORKDIR /opt
RUN apk add --no-cache git=2.38.5-r0 && \
git clone --depth 1 https://github.com/kubernetes/test-infra.git

WORKDIR /opt/test-infra/label_sync
RUN go build

FROM gcr.io/distroless/base:nonroot

COPY --from=builder /opt/test-infra/label_sync/label_sync /bin

ENTRYPOINT ["/bin/label_sync"]

0 comments on commit 6d0a2db

Please sign in to comment.