diff --git a/gdbui_server/DockerFile.dev b/gdbui_server/DockerFile.dev index 6321ffe..7902c71 100644 --- a/gdbui_server/DockerFile.dev +++ b/gdbui_server/DockerFile.dev @@ -3,6 +3,9 @@ FROM python:3.10-slim # Set the working directory WORKDIR /app +# Create a non-root user and group for runtime +RUN groupadd --system appgroup && useradd --system --gid appgroup --create-home appuser + # Copy only the requirements file first to leverage Docker cache COPY requirements.txt . @@ -15,5 +18,10 @@ RUN apt-get update && apt-get install -y gdb # Copy the rest of the application code COPY . . +# Ensure runtime directories are writable by the app user +RUN mkdir -p /app/output && chown -R appuser:appgroup /app + +USER appuser + # Command to run the backend server CMD ["python", "main.py"] diff --git a/webapp/DockerFile.dev b/webapp/DockerFile.dev index 239ecd6..20b134d 100644 --- a/webapp/DockerFile.dev +++ b/webapp/DockerFile.dev @@ -12,6 +12,11 @@ RUN npm install # Copy the rest of the application code COPY . . +# Use the non-root node user provided by the base image +RUN chown -R node:node /app + +USER node + # Expose the port the frontend runs on EXPOSE 5173