Skip to content

Commit

Permalink
gcpviz: Fixed Dockerfile building and add helpful message. (#1361)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrew Gold <41129777+agold-rh@users.noreply.github.com>
  • Loading branch information
rosmo and agold-rh authored Oct 7, 2024
1 parent ece429a commit 34a76fb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
14 changes: 9 additions & 5 deletions tools/gcpviz/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,32 @@
# limitations under the License.
#

FROM golang:1.14 AS builder
FROM golang:1.23 AS builder

WORKDIR /go/src/github.com/GoogleCloudPlatform/professional-services/tools/gcpviz
COPY go.mod go.sum *.go ./
RUN mkdir -p cmd/gcpviz
COPY cmd/gcpviz/*.go ./cmd/gcpviz
RUN cd cmd/gcpviz
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o $GOPATH/bin ./...

FROM google/cloud-sdk:slim

RUN apt-get update
RUN apt-get install -y graphviz
RUN apt-get update && apt-get install -y graphviz

WORKDIR /gcpviz
COPY --from=builder /go/bin/cmd gcpviz
COPY --from=builder /go/bin/gcpviz gcpviz
COPY style.yaml relations.yaml labels.yaml ./
COPY wait_for_export.sh gcpviz.sh ./
COPY redactor.py requirements.txt ./
COPY queries ./queries/

# Install dependencies here, we only have one dependency which doesn't ship as deb
# package for bookworm and other options are excessive:
RUN rm -f /usr/lib/python3.*/EXTERNALLY-MANAGED
RUN pip3 install -r requirements.txt

RUN chmod +x wait_for_export.sh gcpviz.sh redactor.py

ENV PATH "$PATH:/gcpviz"
ENV PATH="$PATH:/gcpviz"

2 changes: 2 additions & 0 deletions tools/gcpviz/gcpviz.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ fi
cd /gcpviz || exit 1
if [ ! -f graph.db ] ; then
./gcpviz -resource-inventory-file cai/resource_inventory.json -mode generate
else
echo "Not regenerating graph database as it exists (graph.db)"
fi

graph=$1
Expand Down

0 comments on commit 34a76fb

Please sign in to comment.