33 lines
690 B
Docker
33 lines
690 B
Docker
# Use a Node.js image for the build stage
|
|
FROM node:14 AS build
|
|
|
|
# Set the working directory
|
|
WORKDIR /app
|
|
|
|
# Copy package.json and package-lock.json (if available)
|
|
COPY package.json ./
|
|
# COPY package-lock.json ./ # Uncomment if you have a package-lock.json
|
|
|
|
# Install dependencies
|
|
RUN npm install
|
|
|
|
# Copy the rest of the application code
|
|
COPY . .
|
|
|
|
# Build the application
|
|
RUN npm run build
|
|
|
|
# Use the busybox image for the final stage
|
|
FROM busybox:latest
|
|
|
|
# Set the working directory
|
|
WORKDIR /app
|
|
|
|
# Copy the built assets from the build stage
|
|
COPY --from=build /app/dist ./
|
|
|
|
# Expose the port the app runs on
|
|
EXPOSE 80
|
|
|
|
# Command to serve the static files
|
|
CMD ["httpd", "-f", "-p", "80"] |