Reaperxxxx commited on
Commit
f3f2ec1
·
verified ·
1 Parent(s): 0aae2a3

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +16 -10
Dockerfile CHANGED
@@ -1,37 +1,43 @@
1
  # Use Node.js 20 base image
2
  FROM node:20
3
 
4
- # Switch to 'root' user to ensure we have permission to modify the file permissions
5
  USER root
6
 
 
 
 
7
  # Create directories for the application
8
  RUN mkdir -p /home/node/app/backend /home/node/app/frontend /home/node/app/userDirectories
9
 
10
  # Set the working directory
11
  WORKDIR /home/node/app
12
 
13
- # Clone the frontend repository from GitHub into the frontend folder
14
  RUN git clone https://github.com/reaperofssa/Kaiju /home/node/app/frontend
15
 
16
- # Copy backend files (assumes you have backend files in a local directory named 'backend')
17
  COPY backend /home/node/app/backend/
18
 
19
- # Copy only package.json (no yarn.lock, to install from package.json dependencies)
20
  COPY package.json /home/node/app/
21
 
22
  # Copy the start script
23
  COPY start.sh /home/node/app/
24
 
25
- # Install dependencies for the backend (from package.json)
26
- RUN yarn install
27
 
28
- # Make the start script executable
29
  RUN chmod +x /home/node/app/start.sh
30
 
31
- # Change ownership of the directories to the 'node' user for permissions
32
- RUN chown -R node:node /home/node/app /home/node/app/userDirectories
 
 
 
33
 
34
- # Switch back to the 'node' user after modifying the permissions
35
  USER node
36
 
37
  # Expose the backend port
 
1
  # Use Node.js 20 base image
2
  FROM node:20
3
 
4
+ # Switch to 'root' user for full permissions during setup
5
  USER root
6
 
7
+ # Install necessary tools
8
+ RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
9
+
10
  # Create directories for the application
11
  RUN mkdir -p /home/node/app/backend /home/node/app/frontend /home/node/app/userDirectories
12
 
13
  # Set the working directory
14
  WORKDIR /home/node/app
15
 
16
+ # Clone the frontend repository into the frontend folder
17
  RUN git clone https://github.com/reaperofssa/Kaiju /home/node/app/frontend
18
 
19
+ # Copy backend files
20
  COPY backend /home/node/app/backend/
21
 
22
+ # Copy only package.json to install dependencies
23
  COPY package.json /home/node/app/
24
 
25
  # Copy the start script
26
  COPY start.sh /home/node/app/
27
 
28
+ # Install backend dependencies with proper permissions
29
+ RUN yarn install && yarn cache clean
30
 
31
+ # Make start.sh executable
32
  RUN chmod +x /home/node/app/start.sh
33
 
34
+ # Set full permissions for userDirectories and the app directory
35
+ RUN chmod -R 755 /home/node/app && chmod -R 777 /home/node/app/userDirectories
36
+
37
+ # Change ownership to 'node' user
38
+ RUN chown -R node:node /home/node/app
39
 
40
+ # Switch back to 'node' user for security
41
  USER node
42
 
43
  # Expose the backend port