Skip to content

Commit

Permalink
change dockerfile frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
pdelebarre committed Oct 29, 2024
1 parent b0c38db commit 004e333
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ WORKDIR /app

# COPY .env .
# Copy package.json and package-lock.json
COPY package*.json ./
COPY ./package.json ./

# Install dependencies
RUN npm install --legacy-peer-deps
Expand All @@ -15,22 +15,23 @@ RUN npm install --legacy-peer-deps
COPY . .

# Build the app for production
RUN npm run build
# RUN npm run build

# Stage 2: Serve the app with NGINX
FROM nginx:alpine
# FROM nginx:alpine

# Copy the built files from the previous stage to the NGINX web root
COPY --from=builder /app/dist /usr/share/nginx/html
# COPY --from=builder /app/dist /usr/share/nginx/html

#shell to be able to catch variables at docker run time
#https://dev.to/sanjayttg/dynamic-environment-variables-for-dockerized-react-apps-5bc5
COPY env.sh /docker-entrypoint.d/env.sh
RUN chmod +x /docker-entrypoint.d/env.sh
# COPY env.sh /docker-entrypoint.d/env.sh
# RUN chmod +x /docker-entrypoint.d/env.sh


# Expose the port NGINX is running on
EXPOSE 80
# EXPOSE 80

# Start NGINX server
CMD ["nginx", "-g", "daemon off;"]
# CMD ["nginx", "-g", "daemon off;"]
CMD ["npm", "run", "start"]

0 comments on commit 004e333

Please sign in to comment.