File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- /** /.idea /
2- /** /.pytest_cache /
3- /** /__pycache__ /
4- /** /venv /
1+ .idea /
2+ .pytest_cache /
3+ __pycache__ /
4+ venv /
5+ CLAUDE.md
6+ plan_ *
7+
Original file line number Diff line number Diff line change 11FROM tiangolo/uvicorn-gunicorn-fastapi:python3.9
22
3+ # Create a non-root user to run the application
4+ RUN groupadd -g 1000 zxbasic && \
5+ useradd -r -u 1000 -g zxbasic -m -d /home/zxbasic -s /bin/bash zxbasic
6+
37WORKDIR /app
48
9+ # Copy requirements as root for installation
510COPY ./requirements.txt /app/requirements.txt
611
12+ # Install dependencies as root
713RUN apt-get update \
814 && apt-get install gcc -y \
915 && apt-get clean
1016
1117RUN pip install -r /app/requirements.txt \
1218 && rm -rf /root/.cache/pip
1319
14- COPY . /app/
20+ # Copy application code and set ownership
21+ COPY --chown=zxbasic:zxbasic . /app/
22+
23+ # Create a directory for temporary files with proper permissions
24+ RUN mkdir -p /tmp/zxbasic && \
25+ chown -R zxbasic:zxbasic /tmp/zxbasic && \
26+ chmod 755 /tmp/zxbasic
27+
28+ # Ensure the app directory is owned by zxbasic user
29+ RUN chown -R zxbasic:zxbasic /app
30+
31+ # Switch to non-root user
32+ USER zxbasic
33+
34+ # Set environment variable for temp directory (optional - Python tempfile will use system default)
35+ # ENV TMPDIR=/tmp/zxbasic
36+
37+ # The container will run with the default command from the base image
You can’t perform that action at this time.
0 commit comments