Skip to content

Commit e2e34fe

Browse files
authored
Change base image to rocky9 (#1894)
* Make use of Rocky9 Linux as base image
1 parent 06f1d04 commit e2e34fe

File tree

3 files changed

+64
-93
lines changed

3 files changed

+64
-93
lines changed

.github/workflows/pull_request.yml

Lines changed: 30 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,11 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- name: Checkout code
17-
uses: actions/checkout@v2
17+
uses: actions/checkout@v4
1818
- name: Set up Go
19-
uses: actions/setup-go@v1
19+
uses: actions/setup-go@v4
2020
with:
21-
go-version: 1.20.6
22-
- uses: actions/cache@v2
23-
with:
24-
path: ~/go/pkg/mod
25-
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
26-
restore-keys: |
27-
${{ runner.os }}-go
21+
go-version: 1.20.11
2822
- name: Get dependencies
2923
run: curl -L --fail "https://github.com/apple/foundationdb/releases/download/${FDB_VER}/foundationdb-clients_${FDB_VER}-1_amd64.deb" -o fdb.deb
3024
- name: Install dependencies
@@ -41,22 +35,16 @@ jobs:
4135
# See https://kubernetes.io/releases for the current releases
4236
kubever: [ "v1.21.1", "v1.22.0", "v1.23.0" ]
4337
steps:
44-
- name: Set up Go
45-
uses: actions/setup-go@v1
46-
with:
47-
go-version: 1.20.6
4838
- name: Check out code into the Go module directory
49-
uses: actions/checkout@v2
39+
uses: actions/checkout@v4
5040
with:
5141
fetch-depth: 0
42+
- name: Set up Go
43+
uses: actions/setup-go@v4
44+
with:
45+
go-version: 1.20.11
5246
- name: Fetch all tags
5347
run: git fetch --force --tags
54-
- uses: actions/cache@v2
55-
with:
56-
path: ~/go/pkg/mod
57-
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
58-
restore-keys: |
59-
${{ runner.os }}-go
6048
- name: Get dependencies
6149
env:
6250
KIND_VER: "v0.11.1"
@@ -108,22 +96,16 @@ jobs:
10896
name: Testing
10997
runs-on: ubuntu-latest
11098
steps:
111-
- name: Set up Go
112-
uses: actions/setup-go@v1
113-
with:
114-
go-version: 1.20.6
11599
- name: Check out code into the Go module directory
116-
uses: actions/checkout@v2
100+
uses: actions/checkout@v4
117101
with:
118102
fetch-depth: 0
103+
- name: Set up Go
104+
uses: actions/setup-go@v4
105+
with:
106+
go-version: 1.20.11
119107
- name: Fetch all tags
120108
run: git fetch --force --tags
121-
- uses: actions/cache@v2
122-
with:
123-
path: ~/go/pkg/mod
124-
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
125-
restore-keys: |
126-
${{ runner.os }}-go
127109
- name: Get dependencies
128110
run: |
129111
# Only download all dependencies
@@ -145,47 +127,43 @@ jobs:
145127
image:
146128
- fdb-kubernetes-operator
147129
- fdb-data-loader
148-
- fdb-kubernetes-operator-distroless
149130
include:
150131
- image: fdb-kubernetes-operator
151132
context: ./
152133
name: foundationdb/fdb-kubernetes-operator
153-
tagSuffix: ""
154-
file: ./Dockerfile
155-
baseImage: "docker.io/debian:bullseye"
156-
- image: fdb-kubernetes-operator-distroless
157-
context: ./
158-
name: foundationdb/fdb-kubernetes-operator
159-
tagSuffix: -distrolesss
160134
file: ./Dockerfile
161-
baseImage: "gcr.io/distroless/base"
162135
- image: fdb-data-loader
163136
context: ./sample-apps/data-loader
164137
name: foundationdb/fdb-data-loader
165-
tagSuffix: ""
166138
file: ./sample-apps/data-loader/Dockerfile
167-
baseImage: ""
168139
steps:
169140
- name: Check out the repo
170-
uses: actions/checkout@v2
141+
uses: actions/checkout@v4
171142
- name: Set up Docker Buildx
172-
uses: docker/setup-buildx-action@v1
143+
uses: docker/setup-buildx-action@v3
173144
- name: Login to DockerHub
174145
if: github.ref == 'refs/heads/main'
175-
uses: docker/login-action@v1
146+
uses: docker/login-action@v3
176147
with:
177148
username: ${{ secrets.DOCKERHUB_USERNAME }}
178149
password: ${{ secrets.DOCKERHUB_TOKEN }}
179-
- name: Get the sha
180-
id: get_sha
181-
run: echo ::set-output name=TAG::${GITHUB_SHA}
182150
- name: Build image
183-
uses: docker/build-push-action@v2
151+
uses: docker/build-push-action@v5
184152
with:
185153
build-args: |
186-
TAG=${{ steps.get_sha.outputs.TAG }}
187-
BASE_IMAGE=${{ matrix.baseImage }}
154+
TAG=${{ github.sha }}
188155
push: ${{ github.ref == 'refs/heads/main' }}
189156
context: ${{ matrix.context }}
190-
tags: ${{ matrix.name }}:latest${{ matrix.tagSuffix }}
157+
tags: ${{ matrix.name }}:latest
191158
file: ${{ matrix.file }}
159+
- name: Run Trivy vulnerability scanner
160+
if: ${{ matrix.image }} == 'fdb-kubernetes-operator'
161+
uses: aquasecurity/trivy-action@master
162+
with:
163+
image-ref: 'docker.io/foundationdb/fdb-kubernetes-operator:latest'
164+
format: 'table'
165+
exit-code: '1'
166+
ignore-unfixed: true
167+
vuln-type: 'os,library'
168+
severity: 'CRITICAL,HIGH'
169+

.github/workflows/release.yaml

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
upload_url: ${{ steps.create_release.outputs.upload_url }}
1212
tag: ${{ steps.get_tag.outputs.TAG }}
1313
steps:
14-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v4
1515
- name: Get the tag without ref
1616
id: get_tag
1717
run: echo ::set-output name=TAG::${GITHUB_REF/refs\/tags\//}
@@ -35,15 +35,15 @@ jobs:
3535
needs: create-release
3636
steps:
3737
- name: Check out code into the Go module directory
38-
uses: actions/checkout@v2
38+
uses: actions/checkout@v4
3939
with:
4040
fetch-depth: 0
4141
- name: Fetch all tags
4242
run: git fetch --force --tags
4343
- name: Set up Go
44-
uses: actions/setup-go@v1
44+
uses: actions/setup-go@v4
4545
with:
46-
go-version: 1.20.6
46+
go-version: 1.20.11
4747
# https://github.com/goreleaser/goreleaser/issues/1311
4848
- name: Get current semver tag
4949
run: echo "::set-output name=CURRENT_TAG::$(git describe --tags --match "v*" --abbrev=0)"
@@ -62,46 +62,34 @@ jobs:
6262
image:
6363
- fdb-kubernetes-operator
6464
- fdb-data-loader
65-
- fdb-kubernetes-operator-distroless
6665
include:
6766
- image: fdb-kubernetes-operator
6867
context: ./
6968
name: foundationdb/fdb-kubernetes-operator
70-
tagSuffix: ""
7169
file: ./Dockerfile
72-
baseImage: "docker.io/debian:bookworm"
73-
- image: fdb-kubernetes-operator-distroless
74-
context: ./
75-
name: foundationdb/fdb-kubernetes-operator
76-
tagSuffix: -distrolesss
77-
file: ./Dockerfile
78-
baseImage: "gcr.io/distroless/base"
7970
- image: fdb-data-loader
8071
context: ./sample-apps/data-loader
8172
name: foundationdb/fdb-data-loader
82-
tagSuffix: ""
8373
file: ./sample-apps/data-loader/Dockerfile
84-
baseImage: ""
8574
steps:
8675
- name: Check out the repo
87-
uses: actions/checkout@v2
76+
uses: actions/checkout@v4
8877
- name: Get the version
8978
id: get_tag
9079
run: echo ::set-output name=TAG::${GITHUB_REF/refs\/tags\//}
9180
- name: Set up Docker Buildx
92-
uses: docker/setup-buildx-action@v1
81+
uses: docker/setup-buildx-action@v3
9382
- name: Login to DockerHub
94-
uses: docker/login-action@v1
83+
uses: docker/login-action@v3
9584
with:
9685
username: ${{ secrets.DOCKERHUB_USERNAME }}
9786
password: ${{ secrets.DOCKERHUB_TOKEN }}
9887
- name: Build and push to registry
99-
uses: docker/build-push-action@v2
88+
uses: docker/build-push-action@v5
10089
with:
10190
build-args: |
10291
TAG=${{ steps.get_sha.outputs.TAG }}
103-
BASE_IMAGE=${{ matrix.baseImage }}
10492
push: true
10593
context: ${{ matrix.context }}
106-
tags: ${{ matrix.name }}:${{ steps.get_tag.outputs.TAG }}${{ matrix.tagSuffix }}
94+
tags: ${{ matrix.name }}:${{ steps.get_tag.outputs.TAG }}
10795
file: ${{ matrix.file }}

Dockerfile

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
1-
ARG BASE_IMAGE=docker.io/debian:bookworm
1+
ARG FDB_VERSION=6.2.29
2+
ARG FDB_WEBSITE=https://github.com/apple/foundationdb/releases/download
23

34
# Build the manager binary
4-
FROM docker.io/library/golang:1.20.6 as builder
5+
FROM docker.io/library/golang:1.20.11 as builder
56

6-
# Install FDB this version is only required to compile the fdb operator
7-
ARG FDB_VERSION=6.2.29
8-
ARG FDB_WEBSITE=https://github.com/apple/foundationdb/releases/download
7+
ARG FDB_VERSION
8+
ARG FDB_WEBSITE
99
ARG TAG="latest"
1010

1111
RUN set -eux && \
12-
curl --fail -L ${FDB_WEBSITE}/${FDB_VERSION}/foundationdb-clients_${FDB_VERSION}-1_amd64.deb -o fdb.deb && \
13-
dpkg -i fdb.deb && \
14-
rm fdb.deb
12+
curl --fail -L "${FDB_WEBSITE}/${FDB_VERSION}/foundationdb-clients_${FDB_VERSION}-1_amd64.deb" -o foundationdb-clients_${FDB_VERSION}-1_amd64.deb && \
13+
curl --fail -L "${FDB_WEBSITE}/${FDB_VERSION}/foundationdb-clients_${FDB_VERSION}-1_amd64.deb" -o foundationdb-clients_${FDB_VERSION}-1_amd64.deb.sha256 && \
14+
# TODO(johscheuer): The 6.2.29 sha256 file is not well formatted, enable this check again once 7.1 is used as base. \
15+
# sha256sum -c foundationdb-clients_${FDB_VERSION}-1_amd64.deb.sha256 && \
16+
dpkg -i foundationdb-clients_${FDB_VERSION}-1_amd64.deb && \
17+
rm foundationdb-clients_${FDB_VERSION}-1_amd64.deb foundationdb-clients_${FDB_VERSION}-1_amd64.deb.sha256
1518

1619
WORKDIR /workspace
1720
# Copy the Go Modules manifests
@@ -42,28 +45,30 @@ RUN groupadd --gid 4059 fdb && \
4245
mkdir -p /var/log/fdb && \
4346
touch /var/log/fdb/.keep
4447

45-
FROM $BASE_IMAGE
48+
FROM docker.io/rockylinux:9.2-minimal
49+
50+
ARG FDB_VERSION
51+
ARG FDB_WEBSITE
4652

4753
VOLUME /usr/lib/fdb
4854

4955
WORKDIR /
5056

57+
RUN set -eux && \
58+
curl --fail -L "${FDB_WEBSITE}/${FDB_VERSION}/foundationdb-clients-${FDB_VERSION}-1.el7.x86_64.rpm" -o foundationdb-clients-${FDB_VERSION}-1.el7.x86_64.rpm && \
59+
curl --fail -L "${FDB_WEBSITE}/${FDB_VERSION}/foundationdb-clients-${FDB_VERSION}-1.el7.x86_64.rpm.sha256" -o foundationdb-clients-${FDB_VERSION}-1.el7.x86_64.rpm.sha256 && \
60+
microdnf install -y glibc && \
61+
microdnf clean all && \
62+
# TODO(johscheuer): The 6.2.29 sha256 file is not well formatted, enable this check again once 7.1 is used as base. \
63+
# sha256sum -c foundationdb-clients-${FDB_VERSION}-1.el7.x86_64.rpm.sha256 && \
64+
rpm -i foundationdb-clients-${FDB_VERSION}-1.el7.x86_64.rpm --excludepath=/usr/bin --excludepath=/usr/lib/foundationdb/backup_agent && \
65+
rm foundationdb-clients-${FDB_VERSION}-1.el7.x86_64.rpm foundationdb-clients-${FDB_VERSION}-1.el7.x86_64.rpm.sha256
66+
5167
COPY --from=builder /etc/passwd /etc/passwd
5268
COPY --from=builder /etc/group /etc/group
5369
COPY --chown=fdb:fdb --from=builder /workspace/bin/manager .
54-
COPY --from=builder /usr/lib/libfdb_c.so /usr/lib/
5570
COPY --chown=fdb:fdb --from=builder /var/log/fdb/.keep /var/log/fdb/.keep
5671

57-
# FoundationDB versions newer than 7.1.33 are complied with the AWS SDK per default and therefore require
58-
# some additional libraries that are not present in the default bookwork image. We copy those
59-
# libraries to make the distroless version of the operator work too, otherwise we could just install
60-
# the required packages.
61-
62-
# This won't work with the current distroless image, as the image depends on debian11, but bookworm is debian12
63-
# see: https://github.com/GoogleContainerTools/distroless/issues/1342
64-
# For now we ignore this and once a debian12 based distroless image is available we can make use of that.
65-
COPY --from=builder /usr/lib/x86_64-linux-gnu/lib* /usr/lib/x86_64-linux-gnu/
66-
6772
# Set to the numeric UID of fdb user to satisfy PodSecurityPolices which enforce runAsNonRoot
6873
USER 4059
6974

0 commit comments

Comments
 (0)