File size: 926 Bytes
cde68dd |
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 |
# Use an official Node.js runtime as a parent image
FROM node:21
# Set the working directory in the container
WORKDIR /app
# Install Python and pip
RUN apt-get update && apt-get install -y \
python3 \
python3-pip \
&& rm -rf /var/lib/apt/lists/* \
&& pip3 install --no-cache-dir --upgrade pip # Upgrade pip to the latest version
# Copy package.json
COPY package.json ./
# Install frontend dependencies
RUN npm install
# Copy the rest of the application code
COPY . .
# Install backend dependencies
RUN pip3 install --no-cache-dir -r requirements.txt
# Build the Next.js app
RUN npm run build
# Make port 8000 available to the world outside this container
EXPOSE 8000
# Set execute permissions for the start script
RUN chmod +x start.sh
# Use a non-root user
RUN useradd -m appuser
USER appuser
# Run the script when the container launches
CMD ["./start.sh"]
|