Skip to content

Commit

Permalink
chore: bump go version of base image to 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
Gregory-Pereira committed Nov 23, 2023
1 parent e0813f4 commit b199bf1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
11 changes: 6 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM registry.access.redhat.com/ubi9/go-toolset@sha256:c3a9c5c7fb226f6efcec2424dd30c38f652156040b490c9eca5ac5b61d8dc3ca AS builder
FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder@sha256:98a0ff138c536eee98704d6909699ad5d0725a20573e2c510a60ef462b45cce0 AS build-env
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

ARG SERVER_LDFLAGS
RUN go build -ldflags "${SERVER_LDFLAGS}" ./cmd/rekor-server
RUN CGO_ENABLED=0 go build -gcflags "all=-N -l" -ldflags "${SERVER_LDFLAGS}" -o rekor-server_debug ./cmd/rekor-server
Expand All @@ -35,7 +36,7 @@ FROM registry.access.redhat.com/ubi9/go-toolset@sha256:c3a9c5c7fb226f6efcec2424d
RUN go install github.com/go-delve/delve/cmd/[email protected]

# overwrite server and include debugger
COPY --from=builder /opt/app-root/src/rekor-server_debug /usr/local/bin/rekor-server
COPY --from=build-env /opt/app-root/src/rekor-server_debug /usr/local/bin/rekor-server

FROM registry.access.redhat.com/ubi9/go-toolset@sha256:c3a9c5c7fb226f6efcec2424dd30c38f652156040b490c9eca5ac5b61d8dc3ca as test

Expand All @@ -53,7 +54,7 @@ RUN mkdir -p /var/run/attestations && \
chmod 777 /var/run/attestations/attestation.json

# overwrite server with test build with code coverage
COPY --from=builder /opt/app-root/src/rekor-server_test /usr/local/bin/rekor-server
COPY --from=build-env /opt/app-root/src/rekor-server_test /usr/local/bin/rekor-server

# Multi-Stage production build
FROM registry.access.redhat.com/ubi9/ubi-minimal@sha256:7d1ea7ac0c6f464dac7bae6994f1658172bf6068229f40778a513bc90f47e624 as deploy
Expand All @@ -66,7 +67,7 @@ LABEL summary="Provides the rekor Server binary for running Rekor-Server"
LABEL com.redhat.component="rekor-server"

# Retrieve the binary from the previous stage
COPY --from=builder /opt/app-root/src/rekor-server /usr/local/bin/rekor-server
COPY --from=build-env /opt/app-root/src/rekor-server /usr/local/bin/rekor-server

# Set the binary as the entrypoint of the container
ENTRYPOINT ["rekor-server"]
10 changes: 7 additions & 3 deletions Dockerfile.backfill-redis
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
#Build stage
FROM registry.access.redhat.com/ubi9/go-toolset@sha256:c3a9c5c7fb226f6efcec2424dd30c38f652156040b490c9eca5ac5b61d8dc3ca AS build-env
FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder@sha256:98a0ff138c536eee98704d6909699ad5d0725a20573e2c510a60ef462b45cce0 AS build-env
USER root
ENV APP_ROOT=/opt/app-root

WORKDIR $APP_ROOT/src/

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

#Install stage
FROM registry.access.redhat.com/ubi9/ubi-minimal@sha256:7d1ea7ac0c6f464dac7bae6994f1658172bf6068229f40778a513bc90f47e624
Expand Down
8 changes: 7 additions & 1 deletion Dockerfile.cli
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
#Build stage
FROM registry.access.redhat.com/ubi9/go-toolset@sha256:c3a9c5c7fb226f6efcec2424dd30c38f652156040b490c9eca5ac5b61d8dc3ca AS build-env
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

WORKDIR /opt/app-root/src

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

RUN git stash && \
export GIT_VERSION=$(git describe --tags --always --dirty) && \
git stash pop && \
go mod vendor && \
make Makefile.swagger && \
make -f Build.mak rekor-cli-darwin-amd64 && \
make -f Build.mak rekor-cli-linux-amd64 && \
Expand Down

0 comments on commit b199bf1

Please sign in to comment.