Kaiju-8 / Dockerfile
Reaperxxxx's picture
Update Dockerfile
f3f2ec1 verified
# Use Node.js 20 base image
FROM node:20
# Switch to 'root' user for full permissions during setup
USER root
# Install necessary tools
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
# Create directories for the application
RUN mkdir -p /home/node/app/backend /home/node/app/frontend /home/node/app/userDirectories
# Set the working directory
WORKDIR /home/node/app
# Clone the frontend repository into the frontend folder
RUN git clone https://github.com/reaperofssa/Kaiju /home/node/app/frontend
# Copy backend files
COPY backend /home/node/app/backend/
# Copy only package.json to install dependencies
COPY package.json /home/node/app/
# Copy the start script
COPY start.sh /home/node/app/
# Install backend dependencies with proper permissions
RUN yarn install && yarn cache clean
# Make start.sh executable
RUN chmod +x /home/node/app/start.sh
# Set full permissions for userDirectories and the app directory
RUN chmod -R 755 /home/node/app && chmod -R 777 /home/node/app/userDirectories
# Change ownership to 'node' user
RUN chown -R node:node /home/node/app
# Switch back to 'node' user for security
USER node
# Expose the backend port
EXPOSE 7860
# Run the application
CMD ["bash", "start.sh"]