first commit
This commit is contained in:
30
s3-nodejs-api/Dockerfile
Normal file
30
s3-nodejs-api/Dockerfile
Normal file
@@ -0,0 +1,30 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
# ARG NODE_VERSION=20-alpine
|
||||
|
||||
# FROM node:${NODE_VERSION} AS base
|
||||
FROM oven/bun:latest AS base
|
||||
WORKDIR /app
|
||||
|
||||
FROM base AS deps
|
||||
COPY package.json ./
|
||||
# Install only production dependencies for the runtime image
|
||||
RUN bun install --omit=dev
|
||||
|
||||
FROM base AS build
|
||||
COPY package.json ./
|
||||
# Install all dependencies for building (includes devDeps like typescript)
|
||||
RUN bun install
|
||||
COPY tsconfig.json ./
|
||||
COPY src ./src
|
||||
RUN bun run build
|
||||
|
||||
FROM base AS runner
|
||||
ENV NODE_ENV=production
|
||||
USER bun
|
||||
WORKDIR /app
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY package.json ./
|
||||
COPY --from=build /app/dist ./dist
|
||||
EXPOSE 3000
|
||||
CMD ["bun", "dist/app.js"]
|
||||
Reference in New Issue
Block a user