diff --git a/Dockerfile b/Dockerfile index c61b7a0..6744d76 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,6 +27,9 @@ COPY . . # Uncomment the following line in case you want to disable telemetry during the build. ENV NEXT_TELEMETRY_DISABLED 1 +# Install dependencies +RUN yarn + # Build the project RUN yarn build @@ -53,8 +56,6 @@ COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static COPY --from=builder --chown=nextjs:nodejs /app/public ./.next/static -# Install dependencies -RUN yarn RUN chown -R nextjs:nodejs /app @@ -64,5 +65,4 @@ EXPOSE 3000 ENV PORT 3000 -ENTRYPOINT yarn react-env -CMD ["node", "server.js"] \ No newline at end of file +CMD ["npm", "run", "start"] \ No newline at end of file diff --git a/package.json b/package.json index 38dd718..f5c2ae8 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 next start -p 3001", + "start": "react-env -- && APP_ENV=production node server.js", "lint": "next lint" }, "dependencies": { diff --git a/yarn.lock b/yarn.lock index 627d0fc..33f9b53 100644 --- a/yarn.lock +++ b/yarn.lock @@ -17,7 +17,8 @@ "@beam-australia/react-env@^3.1.1": version "3.1.1" - resolved "https://registry.npmjs.org/@beam-australia/react-env/-/react-env-3.1.1.tgz" + resolved "https://registry.yarnpkg.com/@beam-australia/react-env/-/react-env-3.1.1.tgz#63cb8316861b8fbdb4b9c550a62139cd90675e40" + integrity sha512-LdWzgqmu116t9+sOvONyB21bBmI8dm8g8s3KhnJVzCcK93GrdSisuIOtOkQPMYgenmVGTWQwWnbLAgoka/jAFw== dependencies: cross-spawn "^6.0.5" dotenv "^8.0.0"