Skip to content

Commit

Permalink
upgrade fe dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
djeck1432 committed Oct 2, 2024
1 parent 295148d commit c17d753
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,32 @@
# Stage 1: Build the react app
FROM node:20 AS build
FROM node:20-alpine AS build

WORKDIR /usr/src/app

# Copy package.json and package-lock.json to install dependencies
COPY package*.json ./

# Install dependencies with legacy peer deps option
RUN npm install --legacy-peer-deps || true
# Install dependencies
# Remove --legacy-peer-deps unless absolutely necessary
RUN npm ci --only=production

# Copy the rest of the application source code
COPY . .

# Build the app (if there are build commands in the package.json)
# Build the app
RUN npm run build

# Stage 2: Serve the built app using nginx
FROM nginx:alpine

# Copy custom nginx configuration
COPY ../spotnet.conf /etc/nginx/conf.d/default.conf

# Copy the built files from the previous stage to the nginx container
COPY --from=build /usr/src/app/build /usr/share/nginx/html

# Expose the port Nginx will listen to
EXPOSE 80

# Use CMD instead of ENTRYPOINT for more flexibility
CMD ["nginx", "-g", "daemon off;"]

0 comments on commit c17d753

Please sign in to comment.