Update docker config for production deployment
This commit is contained in:
@@ -0,0 +1,10 @@
|
|||||||
|
FROM node:18-alpine
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY package*.json ./
|
||||||
|
RUN npm install --production
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
CMD ["npm", "start"]
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
FROM node:18-alpine AS builder
|
||||||
|
WORKDIR /app
|
||||||
|
COPY package*.json ./
|
||||||
|
RUN npm ci
|
||||||
|
COPY . .
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
FROM node:18-alpine AS runner
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
ENV NODE_ENV production
|
||||||
|
ENV NEXT_TELEMETRY_DISABLED 1
|
||||||
|
|
||||||
|
COPY --from=builder /app/public ./public
|
||||||
|
|
||||||
|
# Automatically leverage output traces to reduce image size
|
||||||
|
# https://nextjs.org/docs/advanced-features/output-file-tracing
|
||||||
|
COPY --from=builder /app/.next/standalone ./
|
||||||
|
COPY --from=builder /app/.next/static ./.next/static
|
||||||
|
|
||||||
|
EXPOSE 4000
|
||||||
|
ENV PORT 4000
|
||||||
|
|
||||||
|
CMD ["node", "server.js"]
|
||||||
@@ -5,6 +5,7 @@ const nextConfig: NextConfig = {
|
|||||||
appIsrStatus: false,
|
appIsrStatus: false,
|
||||||
buildActivity: false,
|
buildActivity: false,
|
||||||
},
|
},
|
||||||
|
output: 'standalone',
|
||||||
};
|
};
|
||||||
|
|
||||||
export default nextConfig;
|
export default nextConfig;
|
||||||
|
|||||||
+2
-9
@@ -4,12 +4,9 @@ services:
|
|||||||
frontend:
|
frontend:
|
||||||
build:
|
build:
|
||||||
context: ./client
|
context: ./client
|
||||||
dockerfile: Dockerfile.dev
|
dockerfile: Dockerfile
|
||||||
ports:
|
ports:
|
||||||
- "4000:4000"
|
- "4000:4000"
|
||||||
volumes:
|
|
||||||
- ./client:/app
|
|
||||||
- /app/node_modules
|
|
||||||
environment:
|
environment:
|
||||||
- PORT=4000
|
- PORT=4000
|
||||||
depends_on:
|
depends_on:
|
||||||
@@ -18,13 +15,9 @@ services:
|
|||||||
backend:
|
backend:
|
||||||
build:
|
build:
|
||||||
context: ./api
|
context: ./api
|
||||||
dockerfile: Dockerfile.dev
|
dockerfile: Dockerfile
|
||||||
ports:
|
ports:
|
||||||
- "4001:4001"
|
- "4001:4001"
|
||||||
- "9229:9229"
|
|
||||||
volumes:
|
|
||||||
- ./api:/app
|
|
||||||
- /app/node_modules
|
|
||||||
environment:
|
environment:
|
||||||
- PORT=4001
|
- PORT=4001
|
||||||
- PGHOST=postgres
|
- PGHOST=postgres
|
||||||
|
|||||||
Reference in New Issue
Block a user