-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
16 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |