diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000..a861cc7c1b --- /dev/null +++ b/.dockerignore @@ -0,0 +1,8 @@ +.gitignore +.git +.github +*.md +dist +node_modules/ +Dockerfile +docker-compose.yaml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..52633e17da --- /dev/null +++ b/Dockerfile @@ -0,0 +1,34 @@ +FROM node:20-slim AS base +ENV PNPM_HOME="/pnpm" +ENV PATH="$PNPM_HOME:$PATH" +RUN corepack enable +COPY . /app +WORKDIR /app + +FROM base AS prod-deps +RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile + +FROM base AS build +RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile +RUN pnpm run build + +FROM base +COPY --from=prod-deps /app/node_modules /app/node_modules +COPY --from=build /app/dist /app/dist +EXPOSE 8000 + +FROM base AS app-dependencies + +WORKDIR /github.com/marcellodesales/probot + +COPY package* . + +RUN pnpm install + +FROM app-dependencies + +COPY . . + +RUN pnpm run build + +ENTRYPOINT [ "node", "./bin/create-probot-app.js" ] diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000000..383cbcbc3c --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,7 @@ +services: + + create-probot-app: + image: marcellodesales/create-probot-app + build: + context: . + diff --git a/package.json b/package.json index 6eef86778d..62fa29a14f 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "jsesc": "^3.0.2", "lodash.camelcase": "^4.3.0", "lodash.kebabcase": "^4.1.1", + "npm": "^7.0.0", "simple-git": "^3.22.0", "stringify-author": "^0.1.3", "validate-npm-package-name": "^5.0.0"