-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
frontend/Dockerfile and package.json - use node image and NOT nodemon…
… for startup
- Loading branch information
1 parent
87ac94b
commit 2ea959e
Showing
2 changed files
with
15 additions
and
12 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,17 +1,20 @@ | ||
# Use the official Nginx image | ||
FROM nginx:stable-alpine | ||
# Use the official Node.js LTS image | ||
FROM node:18-alpine | ||
|
||
# Remove the default Nginx welcome page | ||
RUN rm -rf /usr/share/nginx/html/* | ||
# Create and set the working directory | ||
WORKDIR /usr/src/app | ||
|
||
# Copy your static frontend files to the Nginx HTML directory | ||
COPY public/ /usr/share/nginx/html/ | ||
# Copy package.json and package-lock.json to leverage Docker cache | ||
COPY package*.json ./ | ||
|
||
# Optional: Add a custom Nginx configuration if needed | ||
# COPY nginx.conf /etc/nginx/nginx.conf | ||
# Install dependencies | ||
RUN npm install --production | ||
|
||
# Expose port 80 | ||
# Copy the rest of the application code | ||
COPY . . | ||
|
||
# Expose the frontend port | ||
EXPOSE 80 | ||
|
||
# Start Nginx in the foreground | ||
CMD ["nginx", "-g", "daemon off;"] | ||
# Start the Node.js application | ||
CMD ["node", "index.js"] |
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