From 3dd2a059bf8b182b65645d1b66a8098473234721 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 15 Aug 2022 11:23:21 +0000 Subject: [PATCH] fix: gitpod conf and heroku buildpacks --- .gitpod.Dockerfile | 2 ++ .gitpod.yml | 3 ++- apps/api/src/lib/buildPacks/heroku.ts | 14 ++++++++++++-- apps/ui/src/lib/templates.ts | 3 +-- 4 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 .gitpod.Dockerfile diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile new file mode 100644 index 000000000..62de37209 --- /dev/null +++ b/.gitpod.Dockerfile @@ -0,0 +1,2 @@ +FROM gitpod/workspace-node:2022-06-20-19-54-55 +RUN (curl -sSL "https://github.com/buildpacks/pack/releases/download/v0.27.0/pack-v0.27.0-linux.tgz" | tar -C /usr/local/bin/ --no-same-owner -xzv pack) \ No newline at end of file diff --git a/.gitpod.yml b/.gitpod.yml index d46244e67..2cd6c8113 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,7 +1,8 @@ # This configuration file was automatically generated by Gitpod. # Please adjust to your needs (see https://www.gitpod.io/docs/config-gitpod-file) # and commit this file to your remote git repository to share the goodness with others. -image: gitpod/workspace-node:2022-06-20-19-54-55 +image: + file: .gitpod.Dockerfile tasks: - init: pnpm install && pnpm db:push && pnpm db:seed command: pnpm dev diff --git a/apps/api/src/lib/buildPacks/heroku.ts b/apps/api/src/lib/buildPacks/heroku.ts index 1b382547c..3efdeaf6a 100644 --- a/apps/api/src/lib/buildPacks/heroku.ts +++ b/apps/api/src/lib/buildPacks/heroku.ts @@ -2,14 +2,14 @@ import { executeDockerCmd, prisma } from "../common" import { saveBuildLog } from "./common"; export default async function (data: any): Promise { + const { buildId, applicationId, tag, dockerId, debug, workdir } = data try { - const { buildId, applicationId, tag, dockerId, debug, workdir } = data + await saveBuildLog({ line: `Building image started.`, buildId, applicationId }); const { stdout } = await executeDockerCmd({ dockerId, command: `pack build -p ${workdir} ${applicationId}:${tag} --builder heroku/buildpacks:20` }) - if (debug) { const array = stdout.split('\n') for (const line of array) { @@ -24,6 +24,16 @@ export default async function (data: any): Promise { } await saveBuildLog({ line: `Building image successful.`, buildId, applicationId }); } catch (error) { + const array = error.stdout.split('\n') + for (const line of array) { + if (line !== '\n') { + await saveBuildLog({ + line: `${line.replace('\n', '')}`, + buildId, + applicationId + }); + } + } throw error; } } diff --git a/apps/ui/src/lib/templates.ts b/apps/ui/src/lib/templates.ts index e2c023032..ecd669e8e 100644 --- a/apps/ui/src/lib/templates.ts +++ b/apps/ui/src/lib/templates.ts @@ -292,8 +292,7 @@ export const buildPacks = [ fancyName: 'Deno', hoverColor: 'hover:bg-green-700', color: 'bg-green-700' - } - // }, + }, // { // name: 'heroku', // fancyName: 'Heroku Buildpack',