From 46ff8fb35db604c43ac092d4523fd474e14eb414 Mon Sep 17 00:00:00 2001 From: Zach Kirsch Date: Sun, 2 Oct 2022 15:11:25 -0700 Subject: [PATCH] Run local docker as root (#781) --- .../local-generation/docker-utils/src/runDocker.ts | 3 +-- .../src/run-generator/runGenerator.ts | 7 +------ 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/packages/cli/generation/local-generation/docker-utils/src/runDocker.ts b/packages/cli/generation/local-generation/docker-utils/src/runDocker.ts index fd17a4c74db..66e5980c67e 100644 --- a/packages/cli/generation/local-generation/docker-utils/src/runDocker.ts +++ b/packages/cli/generation/local-generation/docker-utils/src/runDocker.ts @@ -1,5 +1,4 @@ import Docker from "dockerode"; -import os from "os"; import { Writable } from "stream"; export declare namespace runDocker { @@ -56,7 +55,7 @@ async function tryRunDocker({ }), { Binds: binds, - User: os.userInfo().uid.toString(), + User: "root", } ); diff --git a/packages/cli/generation/local-generation/local-workspace-runner/src/run-generator/runGenerator.ts b/packages/cli/generation/local-generation/local-workspace-runner/src/run-generator/runGenerator.ts index 5cca78a8e16..ad5334b54ed 100644 --- a/packages/cli/generation/local-generation/local-workspace-runner/src/run-generator/runGenerator.ts +++ b/packages/cli/generation/local-generation/local-workspace-runner/src/run-generator/runGenerator.ts @@ -1,14 +1,9 @@ import { AbsoluteFilePath } from "@fern-api/core-utils"; import { runDocker } from "@fern-api/docker-utils"; import { writeFile } from "fs/promises"; -import path from "path"; +import { DOCKER_CODEGEN_OUTPUT_DIRECTORY, DOCKER_GENERATOR_CONFIG_PATH, DOCKER_PATH_TO_IR } from "./constants"; import { getGeneratorConfig } from "./getGeneratorConfig"; -const DOCKER_FERN_DIRECTORY = "/fern"; -const DOCKER_CODEGEN_OUTPUT_DIRECTORY = path.join(DOCKER_FERN_DIRECTORY, "output"); -const DOCKER_GENERATOR_CONFIG_PATH = path.join(DOCKER_FERN_DIRECTORY, "config.json"); -const DOCKER_PATH_TO_IR = path.join(DOCKER_FERN_DIRECTORY, "ir.json"); - export declare namespace runGenerator { export interface Args { imageName: string;