This commit is contained in:
Liam 2022-10-29 14:27:50 +01:00
parent 8f3d9dc664
commit 65b780ed89
2 changed files with 6 additions and 4 deletions

@ -4,6 +4,9 @@ FROM node:18-alpine AS deps
RUN apk add libc6-compat RUN apk add libc6-compat
WORKDIR /app WORKDIR /app
# Copy cached files
COPY node_modules ./
# Install dependencies based on the preferred package manager # Install dependencies based on the preferred package manager
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./ COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
RUN \ RUN \
@ -13,9 +16,6 @@ RUN \
else echo "Lockfile not found." && exit 1; \ else echo "Lockfile not found." && exit 1; \
fi fi
# Copy cached files
COPY node_modules ./
# Rebuild the source code only when needed # Rebuild the source code only when needed
FROM node:18-alpine AS builder FROM node:18-alpine AS builder
WORKDIR /app WORKDIR /app
@ -59,4 +59,6 @@ EXPOSE 3000
ENV PORT 3000 ENV PORT 3000
ENTRYPOINT yarn react-env --env APP_ENV
CMD ["npm", "run", "start"] CMD ["npm", "run", "start"]

@ -4,7 +4,7 @@
"scripts": { "scripts": {
"dev": "react-env -- next", "dev": "react-env -- next",
"build": "next build", "build": "next build",
"start": "react-env -- && APP_ENV=production node server.js", "start": "APP_ENV=production node server.js",
"lint": "next lint" "lint": "next lint"
}, },
"dependencies": { "dependencies": {