refactor(Dockerfile): Update build process and entry point for TypeScript application
This commit is contained in:
20
Dockerfile
20
Dockerfile
@@ -1,23 +1,23 @@
|
||||
# Typescript Build
|
||||
# Build stage - install dependencies
|
||||
FROM registry.odit.services/hub/oven/bun:1.3.9-alpine AS build
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json bun.lockb* ./
|
||||
RUN bun install --frozen-lockfile
|
||||
|
||||
COPY tsconfig.json ormconfig.js bunfig.toml ./
|
||||
COPY src ./src
|
||||
RUN bun run build \
|
||||
&& rm -rf /app/node_modules \
|
||||
# Production dependencies only
|
||||
RUN rm -rf /app/node_modules \
|
||||
&& bun install --production --frozen-lockfile
|
||||
|
||||
# final image
|
||||
# Final image - run TypeScript directly
|
||||
FROM registry.odit.services/hub/oven/bun:1.3.9-alpine AS final
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=build /app/package.json /app/package.json
|
||||
COPY --from=build /app/bun.lockb* /app/
|
||||
COPY --from=build /app/ormconfig.js /app/ormconfig.js
|
||||
COPY --from=build /app/bunfig.toml /app/bunfig.toml
|
||||
COPY --from=build /app/dist /app/dist
|
||||
COPY --from=build /app/node_modules /app/node_modules
|
||||
ENTRYPOINT ["bun", "/app/dist/app.js"]
|
||||
|
||||
COPY ormconfig.js bunfig.toml tsconfig.json ./
|
||||
COPY src ./src
|
||||
|
||||
ENTRYPOINT ["bun", "/app/src/app.ts"]
|
||||
@@ -4,3 +4,10 @@
|
||||
[runtime]
|
||||
# Enable Node.js compatibility mode
|
||||
bun = true
|
||||
|
||||
# TypeScript transpiler settings
|
||||
# Required for TypeORM decorators
|
||||
[transpiler]
|
||||
tsconfig = "tsconfig.json"
|
||||
emitDecoratorMetadata = true
|
||||
experimentalDecorators = true
|
||||
|
||||
@@ -71,7 +71,6 @@
|
||||
"scripts": {
|
||||
"dev": "bun --watch src/app.ts",
|
||||
"start": "bun src/app.ts",
|
||||
"build": "rimraf ./dist && tsc && cp-cli ./src/static ./dist/static",
|
||||
"docs": "typedoc --out docs src",
|
||||
"test": "jest",
|
||||
"test:watch": "jest --watchAll",
|
||||
@@ -103,4 +102,4 @@
|
||||
"after:bump": "bun run changelog:export && bun run licenses:export && git add CHANGELOG.md && git add licenses.md"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user