diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6ca1e3d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,37 @@ +# Base image +FROM node:18-alpine AS builder + +# Set working directory +WORKDIR /app + +# Copy package files +COPY package*.json ./ + +# Install dependencies +RUN npm install + +# Copy project files +COPY . . + +# Build application +RUN npm run build + +# Production image +FROM node:18-alpine AS runner + +WORKDIR /app + +ENV NODE_ENV=production + +# Copy necessary files from builder +COPY --from=builder /app/next.config.js ./ +COPY --from=builder /app/public ./public +COPY --from=builder /app/.next/static ./.next/static +COPY --from=builder /app/.next/standalone ./ + +EXPOSE 3000 + +ENV PORT 3000 +ENV HOSTNAME "0.0.0.0" + +CMD ["node", "server.js"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..41e8149 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,12 @@ +version: '3.8' + +services: + web: + build: + context: . + dockerfile: Dockerfile + ports: + - "3000:3000" + environment: + - NODE_ENV=production + restart: unless-stopped diff --git a/ecosystem.config.js b/ecosystem.config.js deleted file mode 100644 index 7d59638..0000000 --- a/ecosystem.config.js +++ /dev/null @@ -1,9 +0,0 @@ -module.exports = { - apps: [ - { - name: 'cke', // Замените на имя вашего приложения, если необходимо - script: 'npm', - args: 'run start', - }, - ], -};