build(api): refresh bun config

This commit is contained in:
William Valentin
2025-10-17 09:54:14 -07:00
parent aec89c6f5a
commit 37411bc890
5 changed files with 5403 additions and 951 deletions

View File

@@ -1,20 +1,17 @@
# syntax=docker/dockerfile:1 # syntax=docker/dockerfile:1
# ARG NODE_VERSION=20-alpine ARG BUN_VERSION=1.0.0
# FROM node:${NODE_VERSION} AS base FROM oven/bun:${BUN_VERSION} AS base
FROM oven/bun:latest AS base
WORKDIR /app WORKDIR /app
FROM base AS deps FROM base AS deps
COPY package.json ./ COPY package.json bun.lock ./
# Install only production dependencies for the runtime image RUN bun install --production --no-cache
RUN bun install --omit=dev
FROM base AS build FROM base AS build
COPY package.json ./ COPY package.json bun.lock ./
# Install all dependencies for building (includes devDeps like typescript) RUN bun install --no-cache
RUN bun install
COPY tsconfig.json ./ COPY tsconfig.json ./
COPY src ./src COPY src ./src
RUN bun run build RUN bun run build
@@ -23,8 +20,8 @@ FROM base AS runner
ENV NODE_ENV=production ENV NODE_ENV=production
USER bun USER bun
WORKDIR /app WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules COPY --link --from=deps /app/node_modules ./node_modules
COPY --link --from=build /app/dist ./dist
COPY package.json ./ COPY package.json ./
COPY --from=build /app/dist ./dist
EXPOSE 3000 EXPOSE 3000
CMD ["bun", "dist/app.js"] CMD ["bun", "run", "dist/app.js"]

File diff suppressed because it is too large Load Diff

5139
s3-nodejs-api/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -4,27 +4,26 @@
"description": "A simple application to stream audio files stored in S3.", "description": "A simple application to stream audio files stored in S3.",
"main": "dist/app.js", "main": "dist/app.js",
"scripts": { "scripts": {
"start": "bun dist/app.js", "start": "bun run dist/app.js",
"start:dev": "ts-node src/app.ts", "start:dev": "bun run --watch src/app.ts",
"build": "tsc -p tsconfig.json", "build": "bun run build:tsc",
"test": "jest" "build:tsc": "tsc -p tsconfig.json",
"test": "bun test"
}, },
"dependencies": { "dependencies": {
"aws-sdk": "^2.1234.0", "@aws-sdk/client-s3": "^3.879.0",
"express": "^4.17.1", "express": "^4.18.2",
"morgan": "^1.10.0" "pino": "^9.9.0",
"pino-http": "^10.5.0"
}, },
"devDependencies": { "devDependencies": {
"@types/aws-sdk": "^2.7.0", "@types/express": "^4.17.21",
"@types/express": "^4.17.0", "@types/jest": "^29.5.12",
"@types/jest": "^26.0.0",
"@types/node": "^20.11.0", "@types/node": "^20.11.0",
"jest": "^26.6.0", "ts-node": "^10.9.2",
"ts-jest": "^26.5.0", "typescript": "^5.3.3"
"ts-node": "^9.1.1",
"typescript": "^4.1.3"
}, },
"engines": { "engines": {
"node": ">=12.0.0" "node": ">=18.0.0"
} }
} }

View File

@@ -7,8 +7,9 @@
"skipLibCheck": true, "skipLibCheck": true,
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"outDir": "./dist", "outDir": "./dist",
"rootDir": "./src" "rootDir": "./src",
"typeRoots": ["./src/types", "./node_modules/@types"]
}, },
"include": ["src/**/*.ts"], "include": ["src/**/*.ts"],
"exclude": ["node_modules", "**/*.spec.ts"] "exclude": ["node_modules", "**/*.spec.ts"]
} }