Skip to content

Commit

Permalink
docker file update
Browse files Browse the repository at this point in the history
  • Loading branch information
taulant.disha authored and taulant.disha committed May 16, 2024
1 parent 69d0081 commit a680f12
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,32 +1,24 @@
# Use a Node.js image to build the React app
FROM node:latest as build
WORKDIR /app
ENV PATH /app/node_modules/.bin:$PATH
ENV GENERATE_SOURCEMAP=false
ENV NODE_OPTIONS=--openssl-legacy-provider

# Accept ENV_FILE as a build argument
ARG ENV_FILE
ENV ENV_FILE=${ENV_FILE}

# Copy individual files to avoid path issues
COPY .npmrc .
COPY package.json .
COPY package-lock.json .
# COPY .npmrc ./
COPY package.json ./
COPY package-lock.json ./

# Install dependencies
RUN npm install --legacy-peer-deps

# Copy the specified .env file
COPY ${ENV_FILE} .env

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

# Build the React application
RUN npm run build

# Production environment - use Nginx to serve the built app
FROM nginx:stable-alpine
COPY --from=build /app/build /usr/share/nginx/html
COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf
Expand Down

0 comments on commit a680f12

Please sign in to comment.