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