Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
Catalog fix (#165)
Browse files Browse the repository at this point in the history
* fix: add top level gomod for microservice build

* fix: modify makefile to handle building from root

Signed-off-by: Brian McGinn <[email protected]>

* feat: Add utilities to main

Signed-off-by: Brian McGinn <[email protected]>

* fix: Microservice build from root directory

Signed-off-by: Brian McGinn <[email protected]>

---------

Signed-off-by: Brian McGinn <[email protected]>
  • Loading branch information
brian-intel authored Oct 11, 2023
1 parent 447f488 commit 20d29f2
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 8 deletions.
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,16 @@ install-go-lint:
hadolint:
docker run --rm -v $(pwd):/repo -i hadolint/hadolint:latest-alpine sh -c "cd /repo && hadolint -f json ./**/Dockerfile" > go-hadolint.json

gobuild:
gobuild-authentication:
cd ms-authentication && \
cp -r *.json .. && \
cp ./res/configuration.toml ../res/configuration.toml && \
CGO_ENABLED=1 GOOS=linux go build -ldflags='-s -w' -a -installsuffix cgo main.go && \
cp main ..

gobuild-ledger:
cd ms-ledger && \
cp -r *.json .. && \
cp ./res/configuration.toml ../res/configuration.toml && \
CGO_ENABLED=1 GOOS=linux go build -ldflags='-s -w' -a -installsuffix cgo main.go && \
cp main ..
5 changes: 2 additions & 3 deletions ds-cv-inference/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
RUN apt-get update && apt-get install libgtk2.0-dev libgtk-3-dev libjpeg62 -y
WORKDIR /go/src/ds-cv-inference

COPY go.* /go/src/ds-cv-inference/
RUN go mod download

COPY . /go/src/ds-cv-inference
RUN go mod tidy
RUN go mod download

RUN /bin/bash -c "source /opt/intel/openvino/setupvars.sh && echo building ds-cv-inference... && go build -o ds-cv-inference" && \
chmod +x entrypoint.sh
Expand Down
2 changes: 1 addition & 1 deletion ms-authentication/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ WORKDIR /usr/local/bin/ms-authentication/
COPY . .

# Compile the code
RUN make gobuild
RUN make gobuild-authentication

# Next image - Copy built Go binary into new workspace
FROM alpine
Expand Down
2 changes: 1 addition & 1 deletion ms-authentication/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ docker:
-t $(MICROSERVICE):dev \
.

gobuild: tidy
gobuild-authentication: tidy
CGO_ENABLED=1 GOOS=linux go build -ldflags='-s -w' -a -installsuffix cgo main.go

run:
Expand Down
2 changes: 1 addition & 1 deletion ms-ledger/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ WORKDIR /usr/local/bin/ms-ledger/
COPY . .

# Compile the code
RUN make gobuild
RUN make gobuild-ledger

# Next image - Copy built Go binary into new workspace
FROM alpine
Expand Down
2 changes: 1 addition & 1 deletion ms-ledger/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ docker:
-t $(MICROSERVICE):dev \
.

gobuild: tidy
gobuild-ledger: tidy
CGO_ENABLED=1 GOOS=linux go build -ldflags='-s -w' -a -installsuffix cgo main.go

run:
Expand Down

0 comments on commit 20d29f2

Please sign in to comment.