Spaces:
Sleeping
Sleeping
File size: 1,653 Bytes
73046d5 2888a5b 73046d5 58b31c8 2888a5b 73046d5 2888a5b 58b31c8 2888a5b 73046d5 32a9e13 73046d5 cb666c5 73046d5 fe53290 73046d5 a5a3006 73046d5 bb7e4dc 73046d5 2888a5b 344e17c 73046d5 0105539 f95abd8 73046d5 5d635fb 73046d5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# FROM node:23.7.0 as builder
# # Install git
# RUN apt-get update && apt-get install -y git
# # Clone the GitHub repository (if not already cloned)
# RUN rm -rf /usr/src/app && git clone https://github.com/abubasith456/Node-WLA.git /usr/src/app
# # Set the working directory
# WORKDIR /usr/src/app
# # Change ownership of the directory to the current user (node)
# RUN chown -R node:node /usr/src/app
# # Mark the repository directory as safe
# USER node
# RUN git config --global --add safe.directory /usr/src/app
# # Install npm dependencies
# RUN npm install
# # Expose the port your application runs on
# EXPOSE 5000
# # Ensure that the latest code is pulled before starting the app
# CMD git pull origin main && npm install && npm start
# First stage: Node.js application build
FROM node:23.7.0 AS builder
# Install git
RUN apt-get update && apt-get install -y git
# Clone the GitHub repository
RUN rm -rf /usr/src/app && git clone https://github.com/abubasith456/Node-WLA.git /usr/src/app
# Set working directory
WORKDIR /usr/src/app
# Change ownership of the directory to node user
RUN chown -R node:node /usr/src/app
# Switch to node user
USER node
# Mark the repository directory as safe
RUN git config --global --add safe.directory /usr/src/app
# Install npm dependencies
RUN npm install
# Second stage: Nginx setup
FROM nginx:latest
# Copy built Node.js app from builder stage
COPY --from=builder /usr/src/app /usr/src/app
RUN ls -l nginx.conf
# Copy Nginx configuration file
COPY ./nginx.conf /etc/nginx/nginx.conf
# Expose ports
EXPOSE 80 443 5000
# Start Nginx in the foreground
CMD ["nginx", "-g", "daemon off;"]
|