Skip to content

Commit

Permalink
Merge pull request #1657 from simonbaird/small-dockerfile-delint
Browse files Browse the repository at this point in the history
Some minor Dockerfile delinting
  • Loading branch information
zregvart authored May 31, 2024
2 parents 14e6d43 + 459b2f0 commit 150e55d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ARG TARGETARCH
WORKDIR /build

# Copy just the mod file for better layer caching when building locally
COPY go.mod go.sum .
COPY go.mod go.sum ./
RUN go mod download

# Now copy everything including .git
Expand All @@ -48,11 +48,11 @@ COPY --from=build /build/cosign_version.txt /download/

# Download the matching version of cosign
RUN COSIGN_VERSION=$(cat /download/cosign_version.txt) && \
curl -sLO https://github.com/sigstore/cosign/releases/download/${COSIGN_VERSION}/cosign-${TARGETOS}-${TARGETARCH} && \
curl -sLO https://github.com/sigstore/cosign/releases/download/${COSIGN_VERSION}/cosign_checksums.txt && \
sha256sum --check <(grep -w "cosign-${TARGETOS}-${TARGETARCH}" < cosign_checksums.txt) && \
mv "cosign-${TARGETOS}-${TARGETARCH}" cosign && \
chmod +x cosign
curl -sLO https://github.com/sigstore/cosign/releases/download/${COSIGN_VERSION}/cosign-${TARGETOS}-${TARGETARCH} && \
curl -sLO https://github.com/sigstore/cosign/releases/download/${COSIGN_VERSION}/cosign_checksums.txt && \
sha256sum --check <(grep -w "cosign-${TARGETOS}-${TARGETARCH}" < cosign_checksums.txt) && \
mv "cosign-${TARGETOS}-${TARGETARCH}" cosign && \
chmod +x cosign

FROM registry.access.redhat.com/ubi9/ubi-minimal:9.4@sha256:2636170dc55a0931d013014a72ae26c0c2521d4b61a28354b3e2e5369fa335a3

Expand Down
12 changes: 6 additions & 6 deletions Dockerfile.dist
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ USER root
WORKDIR /build

# Copy just the mod file for better layer caching when building locally
COPY go.mod go.sum .
COPY go.mod go.sum ./
RUN go mod download

# Now copy everything including .git
Expand All @@ -56,11 +56,11 @@ COPY --from=build /build/cosign_version.txt /download/

# Download the matching version of cosign
RUN COSIGN_VERSION=$(cat /download/cosign_version.txt) && \
curl -sLO https://github.com/sigstore/cosign/releases/download/${COSIGN_VERSION}/cosign-${TARGETOS}-${TARGETARCH} && \
curl -sLO https://github.com/sigstore/cosign/releases/download/${COSIGN_VERSION}/cosign_checksums.txt && \
sha256sum --check <(grep -w "cosign-${TARGETOS}-${TARGETARCH}" < cosign_checksums.txt) && \
mv "cosign-${TARGETOS}-${TARGETARCH}" cosign && \
chmod +x cosign
curl -sLO https://github.com/sigstore/cosign/releases/download/${COSIGN_VERSION}/cosign-${TARGETOS}-${TARGETARCH} && \
curl -sLO https://github.com/sigstore/cosign/releases/download/${COSIGN_VERSION}/cosign_checksums.txt && \
sha256sum --check <(grep -w "cosign-${TARGETOS}-${TARGETARCH}" < cosign_checksums.txt) && \
mv "cosign-${TARGETOS}-${TARGETARCH}" cosign && \
chmod +x cosign

## Final image

Expand Down

0 comments on commit 150e55d

Please sign in to comment.