Update Dockerfile
Browse files- 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
|
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
|
14 |
RUN git clone https://github.com/reaperofssa/Kaiju /home/node/app/frontend
|
15 |
|
16 |
-
# Copy backend files
|
17 |
COPY backend /home/node/app/backend/
|
18 |
|
19 |
-
# Copy only package.json
|
20 |
COPY package.json /home/node/app/
|
21 |
|
22 |
# Copy the start script
|
23 |
COPY start.sh /home/node/app/
|
24 |
|
25 |
-
# Install dependencies
|
26 |
-
RUN yarn install
|
27 |
|
28 |
-
# Make
|
29 |
RUN chmod +x /home/node/app/start.sh
|
30 |
|
31 |
-
#
|
32 |
-
RUN
|
|
|
|
|
|
|
33 |
|
34 |
-
# Switch back to
|
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
|