1- # Dockerfile
2-
31# Use the official Python 3.12 image based on Alpine Linux
42FROM python:3.12-alpine
53
64# Set the working directory in the container
75WORKDIR /app
86
9- # --- Install system dependencies and global tools as root ---
10- # 1. Update pip
7+ # --- Install system dependencies and global tools ---
118RUN python -m pip install --upgrade pip
12-
13- # 2. Install Node.js, npm, and live-server
149RUN apk add --no-cache nodejs npm curl && \
1510 npm install -g live-server
1611
17- # --- Create non-root user and group ---
18- # RUN addgroup -S dev-group && adduser -S dev-user -G dev-group
19-
20- # --- Install Python application dependencies (as root) ---
12+ # --- Install Python application dependencies ---
2113COPY requirements.txt .
2214RUN pip install --no-cache-dir -r requirements.txt
2315
24- # --- Install Node.js application dependencies (as root) ---
25- # Copy package files first for caching
26- COPY package.json package-lock.json* ./
27- # Install dependencies
16+ # --- Install Node.js application dependencies ---
17+ # CORRECTED: Copy package files from their new, correct location
18+ COPY app/node/package.json app/node/package-lock.json* ./
2819RUN npm install --no-fund --no-audit
2920
30- # --- Copy application code (as root) ---
31- COPY app_flask.py .
32- COPY app_fastapi.py .
33- COPY app_node.js .
34- COPY ./src /app/src
35-
3621# --- Add healthcheck script ---
3722COPY healthcheck.sh /usr/local/bin/
3823RUN chmod +x /usr/local/bin/healthcheck.sh
3924
40- # --- Change ownership of the application directory ---
41- # RUN chown -R dev-user:dev-group /app
42-
43- # --- Switch to the non-root user ---
44- # USER dev-user
45-
46- # --- Runtime configuration (runs as dev-user) ---
25+ # --- Runtime configuration ---
4726EXPOSE 8080
4827VOLUME /app
0 commit comments