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 5aece7d commit d68c00d
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
# Use node to build
FROM node:20 AS builder
# Using node:20 for the vite to work correct.
FROM node:20

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

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

# Install dependencies and build the production app
RUN npm install
RUN npm run build
# Remove the node_modules folder
RUN rm -rf node_modules

# Use a lightweight web server
FROM nginx:alpine
# Install any needed packages specified in package.json
RUN npm install

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

# Expose port 80 for the NGINX server
EXPOSE 80
# 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

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

0 comments on commit d68c00d

Please sign in to comment.