File size: 1,329 Bytes
834afd7
 
cde68dd
834afd7
 
 
ed30b5b
 
834afd7
 
 
 
 
 
 
 
 
 
 
 
 
cde68dd
834afd7
 
cde68dd
834afd7
 
cde68dd
 
 
 
834afd7
 
 
 
cde68dd
834afd7
 
cde68dd
 
 
 
 
 
 
834afd7
ed30b5b
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
# Use an official Python runtime as a parent image
FROM python:latest

# Set environment variable to avoid buffering issues
ENV PYTHONUNBUFFERED 1

# Make port 7860 available to the world outside this container
EXPOSE 7860

# Update apt and install curl
RUN apt update && apt install -y curl

# Install Node.js from the NodeSource repository
RUN curl -fsSL https://deb.nodesource.com/setup_21.x | bash - && \

    apt install -y nodejs

# Add a non-root user with specific UID and switch to that user
RUN useradd -m -u 1000 appuser
USER appuser
ENV HOME=/home/appuser \
    PATH=/home/appuser/.local/bin:$PATH

# Set the working directory in the container
WORKDIR $HOME/app

# Copy package.json and package-lock.json to the container as appuser
COPY --chown=appuser package*.json ./

# Install frontend dependencies
RUN npm install

# Copy Python requirements file and install backend dependencies
COPY --chown=appuser requirements.txt ./
RUN pip install --upgrade pip && \

    pip install --no-cache-dir -r requirements.txt

# Copy the rest of the application code as appuser
COPY --chown=appuser . .

# Build the Next.js app
RUN npm run build

# Set execute permissions for the start script
RUN chmod +x start.sh

# Set the default command to run the start script
CMD ["./start.sh"]