diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..3b2ae08 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,38 @@ +# Node modules (we'll install fresh in the image) +node_modules +npm-debug.log +yarn-error.log + +# Tests +/**/*.spec.ts + +# Logs +logs +*.log + +# Environment files (optional for security) +.env +.env.* + +# OS & editor junk +.DS_Store +Thumbs.db +*.swp +*.swo +.idea +.vscode + +# Test coverage / build artifacts +coverage +dist +build +tmp +.cache + +# Git +.git +.gitignore + +# Dockerignore itself (not needed inside the image) +.dockerignore +Dockerfile \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..66e81c9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM node:23.11-slim AS node_base +WORKDIR /app + +FROM node_base AS builder +RUN npm install -g typescript shx + +COPY package.json package-lock.json tsconfig.json ./ +RUN --mount=type=cache,target=/root/.npm npm ci --ignore-scripts --omit-dev + +COPY src ./src +RUN --mount=type=cache,target=/root/.npm npm run build + +FROM node_base +COPY package.json package-lock.json ./ +COPY --from=builder /app/dist ./dist +RUN --mount=type=cache,target=/root/.npm npm ci --ignore-scripts --omit-dev +ENTRYPOINT ["node", "/app/dist/index.js"] diff --git a/src/utils/tarball.ts b/src/utils/tarball.ts index 4befc2c..ae64231 100644 --- a/src/utils/tarball.ts +++ b/src/utils/tarball.ts @@ -2,8 +2,8 @@ import zlib from 'node:zlib'; import { readFile, stat, readdir } from 'node:fs/promises'; import path from 'node:path'; import { execSync } from 'node:child_process'; +// @ts-ignore import * as tar from 'tar-stream'; - export type GeneratedContent = { relativePath: string; contents: Uint8Array }; /** * Creates a compressed tarball (tar.gz) from the contents of a workspace folder.