chore(docker): add backend + web Dockerfiles, add standalone output to next.config.ts
This commit is contained in:
parent
5e8c46b5f3
commit
cb684fa086
26
backend/Dockerfile
Normal file
26
backend/Dockerfile
Normal 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
24
web/Dockerfile
Normal 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"]
|
||||
@ -34,6 +34,7 @@ const securityHeaders = [
|
||||
];
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
...(process.env.VERCEL ? {} : { output: 'standalone' }),
|
||||
async headers() {
|
||||
return [
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user