Skip to content

Commit

Permalink
Update Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
sametaln committed Dec 17, 2024
1 parent 80fc9b3 commit 5aece7d
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
# Using node:20 for the vite to work correct.
FROM node:20
# Use node to build
FROM node:20 AS builder

# Set the working directory in the container
# Set the working directory
WORKDIR /app

# Copy the current directory contents into the container at /app. But remove the node_modules folder
# Copy the files
COPY . .

# Remove the node_modules folder
RUN rm -rf node_modules

# Install any needed packages specified in package.json
# Install dependencies and build the production app
RUN npm install
RUN npm run build

# Use a lightweight web server
FROM nginx:alpine

# Make port 3000 available for the vite app
EXPOSE 3000
# Copy the build output to NGINX's HTML directory
COPY --from=builder /app/dist /usr/share/nginx/html

# Define environment variable
#ENV NODE_ENV=development
ENV REACT_APP_API_BASE_URL=http://localhost:30002
ENV VITE_API_URL=http://165.227.166.132:30002
# Expose port 80 for the NGINX server
EXPOSE 80

# Run the app when the container launches
CMD ["npm", "run", "dev"]
# Start NGINX
CMD ["nginx", "-g", "daemon off;"]

0 comments on commit 5aece7d

Please sign in to comment.