forked from UBAutograding/leviathan
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from makeopensource/cli-publish
Cli publish
- Loading branch information
Showing
8 changed files
with
114 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Build the docker cli for docker consumption | ||
|
||
# Build client library | ||
FROM node:20 AS client-builder | ||
|
||
WORKDIR /client | ||
|
||
COPY .spec/client . | ||
|
||
RUN npm install | ||
|
||
# Use an official Node runtime as the parent image | ||
FROM node:20 | ||
|
||
# Set the working directory in the container | ||
WORKDIR /app/cli/hydra/ | ||
|
||
# Copy the application source code | ||
COPY .example/hydra . | ||
|
||
COPY --from=client-builder client client | ||
|
||
# Install the application dependencies | ||
RUN npm install | ||
|
||
RUN npm install ./client | ||
|
||
# Set the entrypoint to run the CLI | ||
ENTRYPOINT ["npm", "run", "cli"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
// implementation for interacting with the leviathan GRPC API | ||
|
||
import grpc from '@grpc/grpc-js'; | ||
import {DockerServiceClient} from "./gen/docker_grpc_pb"; | ||
import {JobServiceClient} from "./gen/jobs_grpc_pb"; | ||
import {CreateRequest} from "./gen/docker_pb"; | ||
import {NewJobRequest} from "./gen/jobs_pb"; | ||
|
||
|
||
export function client() { | ||
const dockerClient = new DockerServiceClient('localhost:50051', grpc.credentials.createInsecure()); | ||
const jobsClient = new JobServiceClient('localhost:50051', grpc.credentials.createInsecure()) | ||
|
||
dockerClient.createContainer(new CreateRequest(), (err, resp) => { | ||
if (err) { | ||
console.error(err); | ||
} else { | ||
console.log("Response :", resp); | ||
} | ||
}); | ||
|
||
jobsClient.newJob(new NewJobRequest(), (err, resp) => { | ||
if (err) { | ||
console.error(err); | ||
} else { | ||
console.log("Response :", resp); | ||
} | ||
}); | ||
} | ||
// // implementation for interacting with the leviathan GRPC API | ||
// | ||
// import grpc from '@grpc/grpc-js'; | ||
// import {DockerServiceClient} from "leviathan-client/index"; | ||
// import {JobServiceClient} from "./gen/jobs_grpc_pb"; | ||
// import {CreateRequest} from "./gen/docker_pb"; | ||
// import {NewJobRequest} from "./gen/jobs_pb"; | ||
// | ||
// | ||
// export function client() { | ||
// const dockerClient = new DockerServiceClient('localhost:50051', grpc.credentials.createInsecure()); | ||
// const jobsClient = new JobServiceClient('localhost:50051', grpc.credentials.createInsecure()) | ||
// | ||
// dockerClient.createContainer(new CreateRequest(), (err, resp) => { | ||
// if (err) { | ||
// console.error(err); | ||
// } else { | ||
// console.log("Response :", resp); | ||
// } | ||
// }); | ||
// | ||
// jobsClient.newJob(new NewJobRequest(), (err, resp) => { | ||
// if (err) { | ||
// console.error(err); | ||
// } else { | ||
// console.log("Response :", resp); | ||
// } | ||
// }); | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
dkbuild: | ||
docker build . -t github.com/makeopensource/leviathan | ||
|
||
dkrun: | ||
docker run -p 9221:9221 github.com/makeopensource/leviathan | ||
|
||
buildrun: | ||
make dkbuild | ||
make dkrun | ||
|
||
pullrun: | ||
docker run -p 9221:9221 ghcr.io/makeopensource/leviathan |