Skip to content

Commit 418a1b6

Browse files
authored
add cgo-enabled build to pass fips check (#296)
1 parent b429ac3 commit 418a1b6

File tree

3 files changed

+43
-2
lines changed

3 files changed

+43
-2
lines changed

.tekton/quay-builder-v3-10-pull-request.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ spec:
3030
value:
3131
- linux/x86_64
3232
- name: dockerfile
33-
value: Dockerfile
33+
value: Containerfile.quay-builder
3434
- name: build-source-image
3535
value: "true"
3636
- name: hermetic

.tekton/quay-builder-v3-10-push.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ spec:
3030
- linux/ppc64le
3131
- linux/s390x
3232
- name: dockerfile
33-
value: Dockerfile
33+
value: Containerfile.quay-builder
3434
- name: build-source-image
3535
value: "true"
3636
- name: hermetic

Containerfile.quay-builder

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Strictly for fips build
2+
FROM registry.access.redhat.com/ubi8/go-toolset:1.23.6-2 as build
3+
USER root
4+
RUN dnf install -y --setopt=tsflags=nodocs git
5+
COPY . /go/src/
6+
7+
RUN sed -i 's/CGO_ENABLED=0 /CGO_ENABLED=1 /;s/containers_image_openpgp/& strictfipsruntime/' /go/src/Makefile
8+
9+
RUN cd /go/src/ && make build
10+
11+
FROM registry.access.redhat.com/ubi8/podman
12+
LABEL maintainer "Quay devel<[email protected]>"
13+
14+
15+
RUN set -ex\
16+
; dnf install -y --setopt=tsflags=nodocs --setopt=skip_missing_names_on_install=False git wget \
17+
; dnf -y -q clean all
18+
19+
COPY --from=build /go/src/bin/quay-builder /usr/local/bin
20+
COPY buildpack/ssh-git.sh /
21+
COPY entrypoint.sh /home/podman/entrypoint.sh
22+
23+
# Rootless/unprivileged buildah configurations
24+
# https://github.com/containers/buildah/blob/main/docs/tutorials/05-openshift-rootless-build.md
25+
RUN touch /etc/subgid /etc/subuid && \
26+
chmod g=u /etc/subgid /etc/subuid /etc/passwd && \
27+
echo 'podman:100000:65536' > /etc/subuid && echo 'podman:100000:65536' > /etc/subgid && \
28+
# Set driver to VFS, which doesn't require host modifications compared to overlay
29+
# Set shortname aliasing to permissive - https://www.redhat.com/sysadmin/container-image-short-names
30+
mkdir -p /home/podman/.config/containers && \
31+
(echo '[storage]';echo 'driver = "vfs"') > /home/podman/.config/containers/storage.conf && \
32+
sed -i 's/short-name-mode="enforcing"/short-name-mode="permissive"/g' /etc/containers/registries.conf && \
33+
mkdir /certs /home/podman/.config/cni && chown podman:podman /certs /home/podman/.config/cni
34+
35+
VOLUME [ "/certs" ]
36+
37+
WORKDIR /home/podman
38+
39+
USER podman
40+
41+
ENTRYPOINT ["sh", "/home/podman/entrypoint.sh"]

0 commit comments

Comments
 (0)