Skip to content

Commit

Permalink
frontend/Dockerfile and package.json - use node image and NOT nodemon…
Browse files Browse the repository at this point in the history
… for startup
  • Loading branch information
samuelberston committed Nov 12, 2024
1 parent 87ac94b commit 2ea959e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
25 changes: 14 additions & 11 deletions frontend/Dockerfile
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"]
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"test": "tests"
},
"scripts": {
"start": "nodemon index.js",
"start": "node index.js",
"test": "jest"
},
"repository": {
Expand Down

0 comments on commit 2ea959e

Please sign in to comment.