This commit is contained in:
parent
1bd0579c41
commit
09cb4efd55
@ -1,21 +1,22 @@
|
|||||||
# Use an official node runtime as a parent image
|
FROM node:18-alpine AS builder
|
||||||
FROM node:20
|
RUN mkdir /app
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
# Set the working directory to /client
|
COPY . /app
|
||||||
WORKDIR /client
|
|
||||||
|
|
||||||
# Copy package.json and package-lock.json to /client
|
RUN cd /app && npm install && npm build
|
||||||
COPY package*.json ./
|
|
||||||
|
|
||||||
# Install any needed packages specified in package.json
|
FROM node:18-alpine
|
||||||
RUN npm install
|
|
||||||
|
|
||||||
# Copy the current directory contents into the container at /client
|
RUN mkdir /app
|
||||||
COPY . .
|
|
||||||
|
|
||||||
# Build the app
|
COPY --from=builder /app/build /app/build
|
||||||
RUN npm run build
|
COPY --from=builder /app/package.json /app/npm.lock /app/
|
||||||
|
|
||||||
# Serve the app
|
RUN cd /app && \
|
||||||
RUN npm install -g serve
|
npm install --production &&\
|
||||||
CMD ["serve", "-s", "public", "-l", "3000"]
|
npm cache clean
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
CMD ["node", "build/index.js"]
|
Loading…
Reference in New Issue
Block a user