File tree Expand file tree Collapse file tree 4 files changed +31
-2
lines changed Expand file tree Collapse file tree 4 files changed +31
-2
lines changed Original file line number Diff line number Diff line change 77
88env :
99 SOLANA_VERSION : 1.10.29
10+ SOLANA_DOCKER_IMAGE_HASH : 78900501ccd1ade1bf088fa0830c46bc6095c6799469ff9b335e1f02d957e53a
1011 DOCKER_HUB : docker.io
1112 DOCKER_USER : ${{ secrets.DOCKER_IO_USER }}
1213 IS_RELEASE : ${{
3536 docker build \
3637 --file docker/Dockerfile \
3738 --build-arg SOLANA_VERSION="${SOLANA_VERSION}" \
39+ --build-arg SOLANA_DOCKER_IMAGE_HASH="${SOLANA_DOCKER_IMAGE_HASH}" \
3840 --tag "${DOCKER_IMAGE}" \
3941 .
4042
4951 docker image push "${PUB_IMAGE}"
5052 }
5153 echo "${{ secrets.DOCKER_IO_PASS }}" | publish
54+ pinning :
55+ runs-on : ubuntu-latest
56+ steps :
57+ - name : Check out source
58+ uses : actions/checkout@v2
59+ - run : chmod 755 ./scripts/check-docker-pin.sh
60+ - run : ./scripts/check-docker-pin.sh
Original file line number Diff line number Diff line change 11ARG SOLANA_VERSION
2- FROM solanalabs/solana:v${SOLANA_VERSION}
2+ ARG SOLANA_DOCKER_IMAGE_HASH
3+ FROM solanalabs/solana:v${SOLANA_VERSION}@sha256:${SOLANA_DOCKER_IMAGE_HASH}
34
45# Redeclare SOLANA_VERSION in the new build stage.
56# Persist in env for docker run & inspect.
Original file line number Diff line number Diff line change 1- FROM ubuntu:20.04
1+ FROM ubuntu:20.04@sha256:fd92c36d3cb9b1d027c4d2a72c6bf0125da82425fc2ca37c414d4f010180dc19
22
33ENV DEBIAN_FRONTEND=noninteractive
44RUN apt-get update
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ # This script is checks to that all our Docker images are pinned to a specific SHA256 hash
4+ #
5+ # References as to why...
6+ # - https://nickjanetakis.com/blog/docker-tip-18-please-pin-your-docker-image-versions
7+ # - https://snyk.io/blog/10-docker-image-security-best-practices/ (Specifically: USE FIXED TAGS FOR IMMUTABILITY)
8+ #
9+ # Explaination of regex ignore choices
10+ # - We ignore sha256 because it suggests that the image dep is pinned
11+ # - We ignore scratch because it's literally the docker base image
12+ #
13+ git ls-files | grep " Dockerfile*" | xargs grep -s " FROM" | egrep -v ' sha256|scratch'
14+ if [ $? -eq 0 ]; then
15+ echo " [!] Unpinned docker files" >&2
16+ exit 1
17+ else
18+ echo " [+] No unpinned docker files"
19+ fi
You can’t perform that action at this time.
0 commit comments