diff --git a/Dockerfile b/Dockerfile index 3437c22..2c7f82a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,6 +4,9 @@ FROM node:18-alpine AS deps RUN apk add libc6-compat WORKDIR /app +# Copy cached files +COPY node_modules ./ + # Install dependencies based on the preferred package manager COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./ RUN \ @@ -13,9 +16,6 @@ RUN \ else echo "Lockfile not found." && exit 1; \ fi -# Copy cached files -COPY node_modules ./ - # Rebuild the source code only when needed FROM node:18-alpine AS builder WORKDIR /app @@ -59,4 +59,6 @@ EXPOSE 3000 ENV PORT 3000 +ENTRYPOINT yarn react-env --env APP_ENV + CMD ["npm", "run", "start"] \ No newline at end of file diff --git a/package.json b/package.json index f5c2ae8..4e6a2cd 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "scripts": { "dev": "react-env -- next", "build": "next build", - "start": "react-env -- && APP_ENV=production node server.js", + "start": "APP_ENV=production node server.js", "lint": "next lint" }, "dependencies": {