Skip to content

Commit

Permalink
Added dockerfiles and additional instructions to each tool
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanperry1 committed Nov 17, 2023
1 parent 0fae34e commit 818df03
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 2 deletions.
21 changes: 21 additions & 0 deletions samples/anomaly-detection/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# syntax=docker/dockerfile:1

FROM mcr.microsoft.com/oss/go/microsoft/golang:1.21-cbl-mariner2.0 AS build

COPY ./lib /workdir/lib

COPY ./samples/anomaly-detection /workdir/samples/anomaly-detection

WORKDIR /workdir/samples/anomaly-detection

RUN go mod download

RUN go install github.com/magefile/mage@latest

RUN mage ci

RUN go build -o ./bin/anomaly-detection ./cmd/anomaly-detection

EXPOSE 2112

CMD [ "/bin/anomaly-detection" ]
21 changes: 21 additions & 0 deletions samples/anomaly-detection/magefile.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

//go:build mage

package main

import (
//mage:import
"github.com/explore-iot-ops/lib/mage"
)

func CI() error {
return mage.CI(
"github.com/explore-iot-ops/samples/anomaly-detection/",
map[string]any{"cmd": nil},
3000,
0.00,
0.00,
)
}
2 changes: 1 addition & 1 deletion samples/http-grpc-callout/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ RUN go build -o ./bin/http-grpc-callout ./cmd/http-grpc-callout

EXPOSE 2112

CMD [ "/bin/callout" ]
CMD [ "/bin/http-grpc-callout" ]
21 changes: 21 additions & 0 deletions samples/http-grpc-shift-calculation/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# syntax=docker/dockerfile:1

FROM mcr.microsoft.com/oss/go/microsoft/golang:1.21-cbl-mariner2.0 AS build

COPY ./lib /workdir/lib

COPY ./samples/http-grpc-shift-calculation /workdir/samples/http-grpc-shift-calculation

WORKDIR /workdir/samples/http-grpc-shift-calculation

RUN go mod download

RUN go install github.com/magefile/mage@latest

RUN mage ci

RUN go build -o ./bin/http-grpc-shift-calculation ./cmd/http-grpc-shift-calculation

EXPOSE 2112

CMD [ "/bin/http-grpc-shift-calculation" ]
21 changes: 20 additions & 1 deletion samples/http-grpc-shift-calculation/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
# HTTP/GRPC Shift Calculator

## Server Configuration
## Usage

### Server as a Pod

```sh
# From the root of the http-grpc-shift-calculation directory.
docker build ../.. -f Dockerfile -t <yourcrhere>.azurecr.io/http-grpc-shift-calculation:latest

# Or if running from the root of the explore-iot-operations repository.
# docker build . -f ./samples/http-grpc-shift-calculation/Dockerfile -t <yourcrhere>.azurecr.io/http-grpc-shift-calculation:latest

# Push or load your newly built image into your cluster, depending on the k8s setup.
# docker push <yourcrhere>.azurecr.io/http-grpc-shift-calculation:latest # Using AKS + Connected ACR
# minikube load <yourcrhere>.azurecr.io/http-grpc-shift-calculation:latest # Using minikube
# docker save <yourcrhere>.azurecr.io/http-grpc-shift-calculation:latest | k3s ctr images import - # Using K3s

kubectl run http-grpc-shift-calculation --image=<yourcrhere>.azurecr.io/http-grpc-shift-calculation:latest --stdin < config.yml
```

### Server Configuration

```yaml
logger: # Logger related settings.
Expand Down
21 changes: 21 additions & 0 deletions samples/http-grpc-shift-calculation/magefile.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

//go:build mage

package main

import (
//mage:import
"github.com/explore-iot-ops/lib/mage"
)

func CI() error {
return mage.CI(
"github.com/explore-iot-ops/samples/http-grpc-shift-calculation/",
map[string]any{"cmd": nil},
3000,
0.00,
0.00,
)
}

0 comments on commit 818df03

Please sign in to comment.