Skip to content

Commit

Permalink
feat: Set up new Docker image with Google Chrome
Browse files Browse the repository at this point in the history
  • Loading branch information
agallardol committed Nov 23, 2024
1 parent 9ef620e commit f497915
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 10 deletions.
7 changes: 6 additions & 1 deletion apps/shinkai-tool-aave-loan-requester/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@ export const run: Run<Configurations, Parameters, Result> = async (
configurations,
parameters,
): Promise<Result> => {
const chromePath =
configurations?.chromePath ||
process.env.CHROME_PATH ||
chromePaths.chrome ||
chromePaths.chromium;
const browser = await playwright['chromium'].launch({
executablePath: configurations?.chromePath || chromePaths.chrome,
executablePath: chromePath,
});
const context = await browser.newContext({
viewport: { width: 1280, height: 800 }, // Set viewport size
Expand Down
7 changes: 6 additions & 1 deletion apps/shinkai-tool-aave-state/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@ export const run: Run<Configurations, Parameters, Result> = async (
configurations,
_parameters,
): Promise<Result> => {
const chromePath =
configurations?.chromePath ||
process.env.CHROME_PATH ||
chromePaths.chrome ||
chromePaths.chromium;
const browser = await playwright['chromium'].launch({
executablePath: configurations?.chromePath || chromePaths.chrome,
executablePath: chromePath,
});
const context = await browser.newContext({
viewport: { width: 1280, height: 800 }, // Set viewport size
Expand Down
6 changes: 5 additions & 1 deletion apps/shinkai-tool-defillama-tvl-rankings/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,11 @@ export const run: Run<Config, Params, Result> = (
configurations: Config,
params: Params,
): Promise<Result> => {
const chromePath = configurations?.chromePath || chromePaths.chrome;
const chromePath =
configurations?.chromePath ||
process.env.CHROME_PATH ||
chromePaths.chrome ||
chromePaths.chromium;
return withPage(chromePath, async (page) => {
const categories = await getCategories(page);

Expand Down
7 changes: 6 additions & 1 deletion apps/shinkai-tool-perplexity/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,13 @@ export const run: Run<Configurations, Parameters, Result> = async (
navigationTimeout: 60 * 1000,
},
});
const chromePath =
configurations?.chromePath ||
process.env.CHROME_PATH ||
chromePaths.chrome ||
chromePaths.chromium;
const browser = await playwright['chromium'].launch({
executablePath: configurations?.chromePath || chromePaths.chrome,
executablePath: chromePath,
});
const context = await browser.newContext({
viewport: { width: 1280, height: 800 }, // Set viewport size
Expand Down
3 changes: 2 additions & 1 deletion apps/shinkai-tool-playwright-example/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ export const run: Run<Configurations, Parameters, Result> = async (
): Promise<Result> => {
const chromePath =
configurations?.chromePath ||
process.env.CHROME_BIN ||
process.env.CHROME_PATH ||
chromePaths.chrome ||
chromePaths.chromium;

console.log('executing chrome from', chromePath);
const browser = await playwright['chromium'].launch({
executablePath: chromePath,
Expand Down
11 changes: 11 additions & 0 deletions docker-images/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

FROM denoland/deno:debian-2.1.1
RUN apt-get update && apt-get install -y curl

# Install Google Chrome
RUN curl -LO https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
RUN apt-get install -y ./google-chrome-stable_current_amd64.deb
RUN rm google-chrome-stable_current_amd64.deb
RUN apt-get install -y chromium

ENV CHROME_PATH=/usr/bin/google-chrome
2 changes: 1 addition & 1 deletion libs/shinkai-tools-runner/src/tools/deno_runner_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ impl Default for DenoRunnerOptions {
fn default() -> Self {
Self {
context: ExecutionContext::default(),
deno_image_name: String::from("denoland/deno:alpine-2.0.6"),
deno_image_name: String::from("dcspark/shinkai-code-runner:0.8.0"),
deno_binary_path: PathBuf::from(if cfg!(windows) {
"./shinkai-tools-runner-resources/deno.exe"
} else {
Expand Down
5 changes: 1 addition & 4 deletions libs/shinkai-tools-runner/src/tools/tool.test.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
use std::{
collections::HashMap,
path::{Path, PathBuf},
};
use std::{collections::HashMap, path::PathBuf};

use serde_json::Value;

Expand Down

0 comments on commit f497915

Please sign in to comment.