Skip to content

Commit

Permalink
enable hermetic builds
Browse files Browse the repository at this point in the history
additionally adding prefetch-input but commenting it out due to pre-fetch dependencies go 1.21 dependency
  • Loading branch information
Gregory-Pereira committed Nov 28, 2023
1 parent 861d566 commit f6fad4b
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 11 deletions.
1 change: 0 additions & 1 deletion .dockerignore

This file was deleted.

4 changes: 4 additions & 0 deletions .tekton/backfill-redis-1-0-gamma-pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ spec:
value: '{{revision}}'
- name: build-source-image
value: "true"
- name: hermetic
value: "true"
- name: prefetch-input
value: [{"path": ".", "type": "gomod"}, {"path": "./hack/tools", "type": "gomod"}]
pipelineSpec:
finally:
- name: show-sbom
Expand Down
4 changes: 4 additions & 0 deletions .tekton/backfill-redis-1-0-gamma-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ spec:
value: '{{revision}}'
- name: build-source-image
value: "true"
- name: hermetic
value: "true"
- name: prefetch-input
value: [{"path": ".", "type": "gomod"}, {"path": "./hack/tools", "type": "gomod"}]
pipelineSpec:
finally:
- name: show-sbom
Expand Down
4 changes: 4 additions & 0 deletions .tekton/rekor-server-1-0-gamma-pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ spec:
value: '{{revision}}'
- name: build-source-image
value: "true"
- name: hermetic
value: "true"
- name: prefetch-input
value: [{"path": ".", "type": "gomod"}, {"path": "./hack/tools", "type": "gomod"}]
pipelineSpec:
finally:
- name: show-sbom
Expand Down
4 changes: 4 additions & 0 deletions .tekton/rekor-server-1-0-gamma-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ spec:
value: '{{revision}}'
- name: build-source-image
value: "true"
- name: hermetic
value: "true"
- name: prefetch-input
value: [{"path": ".", "type": "gomod"}, {"path": "./hack/tools", "type": "gomod"}]
pipelineSpec:
finally:
- name: show-sbom
Expand Down
8 changes: 7 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,23 @@
# limitations under the License.

FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder@sha256:98a0ff138c536eee98704d6909699ad5d0725a20573e2c510a60ef462b45cce0 AS build-env

RUN mkdir /opt/app-root && mkdir /opt/app-root/src && mkdir /opt/app-root/src/cmd && mkdir /opt/app-root/src/pkg && git config --global --add safe.directory /opt/app-root/src

ENV APP_ROOT=/opt/app-root
ENV GOPATH=$APP_ROOT

WORKDIR $APP_ROOT/src/
ADD go.mod go.sum $APP_ROOT/src/
RUN go mod download

# Add source code
ADD ./cmd/ $APP_ROOT/src/cmd/
ADD ./pkg/ $APP_ROOT/src/pkg/

RUN go mod tidy && go mod vendor
# Add source code
ADD ./cmd/ $APP_ROOT/src/cmd/
ADD ./pkg/ $APP_ROOT/src/pkg/

ARG SERVER_LDFLAGS
RUN go build -ldflags "${SERVER_LDFLAGS}" ./cmd/rekor-server
Expand Down
16 changes: 9 additions & 7 deletions Dockerfile.backfill-redis
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
#Build stage
# Build stage

FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder@sha256:98a0ff138c536eee98704d6909699ad5d0725a20573e2c510a60ef462b45cce0 AS build-env
USER root
ENV APP_ROOT=/opt/app-root
RUN mkdir /opt/app-root && mkdir /opt/app-root/src && mkdir /opt/app-root/src/cmd && mkdir /opt/app-root/src/pkg && git config --global --add safe.directory /opt/app-root/src

WORKDIR /opt/app-root/src/

COPY . .

WORKDIR $APP_ROOT/src/
run make backfill-redis

RUN git config --global --add safe.directory /opt/app-root/src
ADD . .
RUN go mod tidy && go mod vendor && make backfill-redis

#Install stage
# Install stage
FROM registry.access.redhat.com/ubi9/ubi-minimal@sha256:7d1ea7ac0c6f464dac7bae6994f1658172bf6068229f40778a513bc90f47e624
COPY --from=build-env /opt/app-root/src/backfill-redis /usr/local/bin/backfill-redis
WORKDIR /opt/app-root/src/home
Expand Down
3 changes: 1 addition & 2 deletions Dockerfile.cli
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder@sha256:98a0ff138c536eee98704d6909699ad5d0725a20573e2c510a60ef462b45cce0 AS build-env
USER root

RUN mkdir /opt/app-root && mkdir /opt/app-root/src
RUN mkdir /opt/app-root && mkdir /opt/app-root/src && git config --global --add safe.directory /opt/app-root/src

WORKDIR /opt/app-root/src

RUN git config --global --add safe.directory /opt/app-root/src
COPY . .

WORKDIR /opt/app-root/src/hack/tools
Expand Down

0 comments on commit f6fad4b

Please sign in to comment.