chore(docker): add backend + web Dockerfiles, add standalone output to next.config.ts

This commit is contained in:
saravanakumardb1 2026-03-22 00:20:20 -07:00
parent 5e8c46b5f3
commit cb684fa086
3 changed files with 51 additions and 0 deletions

26
backend/Dockerfile Normal file
View File

@ -0,0 +1,26 @@
# Pre-requisite: run ./scripts/docker-prep.sh to pack @bytelyst/* tarballs
FROM node:22-alpine AS builder
WORKDIR /app
COPY package.json package-lock.json ./
COPY .tarballs/ ./.tarballs/
RUN npm ci --ignore-scripts
COPY tsconfig.json ./
COPY src/ ./src/
RUN npx tsc
# Production stage
FROM node:22-alpine
WORKDIR /app
ENV NODE_ENV=production
COPY package.json package-lock.json ./
COPY .tarballs/ ./.tarballs/
RUN npm ci --omit=dev --ignore-scripts
COPY --from=builder /app/dist ./dist
COPY shared/ ./shared/ 2>/dev/null || true
EXPOSE 4011
CMD ["node", "dist/server.js"]

24
web/Dockerfile Normal file
View File

@ -0,0 +1,24 @@
# Pre-requisite: run ./scripts/docker-prep.sh to pack @bytelyst/* tarballs
FROM node:22-alpine AS builder
WORKDIR /app
COPY package.json package-lock.json ./
COPY .tarballs/ ./.tarballs/
RUN npm ci
COPY . .
ENV NEXT_TELEMETRY_DISABLED=1
RUN npm run build
FROM node:22-alpine
WORKDIR /app
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
COPY --from=builder /app/public ./public 2>/dev/null || true
EXPOSE 3000
CMD ["node", "server.js"]

View File

@ -34,6 +34,7 @@ const securityHeaders = [
];
const nextConfig: NextConfig = {
...(process.env.VERCEL ? {} : { output: 'standalone' }),
async headers() {
return [
{