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 7
7
8
8
env :
9
9
SOLANA_VERSION : 1.10.29
10
+ SOLANA_DOCKER_IMAGE_HASH : 78900501ccd1ade1bf088fa0830c46bc6095c6799469ff9b335e1f02d957e53a
10
11
DOCKER_HUB : docker.io
11
12
DOCKER_USER : ${{ secrets.DOCKER_IO_USER }}
12
13
IS_RELEASE : ${{
35
36
docker build \
36
37
--file docker/Dockerfile \
37
38
--build-arg SOLANA_VERSION="${SOLANA_VERSION}" \
39
+ --build-arg SOLANA_DOCKER_IMAGE_HASH="${SOLANA_DOCKER_IMAGE_HASH}" \
38
40
--tag "${DOCKER_IMAGE}" \
39
41
.
40
42
49
51
docker image push "${PUB_IMAGE}"
50
52
}
51
53
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 1
1
ARG 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}
3
4
4
5
# Redeclare SOLANA_VERSION in the new build stage.
5
6
# 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
2
2
3
3
ENV DEBIAN_FRONTEND=noninteractive
4
4
RUN 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