fix: move uvicorn to port 8080 so non-root user can bind
Non-root users cannot bind to privileged ports (<1024) without ambient capabilities, which Docker does not set by default. Switch uvicorn, healthcheck, and docker-compose port mapping from 80 to 8080. Also combine the two RUN instructions for user/directory setup into one layer. Addresses review feedback on #122. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
e3e1358b1f
commit
9a8f257081
@ -23,15 +23,16 @@ RUN pip install --no-cache-dir --upgrade pip && \
|
|||||||
COPY ./app /usr/src/app/app
|
COPY ./app /usr/src/app/app
|
||||||
|
|
||||||
# Create non-root user and set up directories for volumes
|
# Create non-root user and set up directories for volumes
|
||||||
RUN addgroup --system appuser && adduser --system --ingroup appuser appuser
|
RUN addgroup --system appuser && \
|
||||||
RUN mkdir -p /usr/src/app/storage /usr/src/app/logs && \
|
adduser --system --ingroup appuser appuser && \
|
||||||
|
mkdir -p /usr/src/app/storage /usr/src/app/logs && \
|
||||||
chown -R appuser:appuser /usr/src/app
|
chown -R appuser:appuser /usr/src/app
|
||||||
USER appuser
|
USER appuser
|
||||||
|
|
||||||
# Health check
|
# Health check
|
||||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
|
||||||
CMD curl -f http://localhost:80/api/v3/current || exit 1
|
CMD curl -f http://localhost:8080/api/v3/current || exit 1
|
||||||
|
|
||||||
# Start uvicorn
|
# Start uvicorn
|
||||||
ENV WEB_WORKERS=2
|
ENV WEB_WORKERS=2
|
||||||
CMD ["sh", "-c", "exec uvicorn app.main:app --host 0.0.0.0 --port 80 --workers $WEB_WORKERS"]
|
CMD ["sh", "-c", "exec uvicorn app.main:app --host 0.0.0.0 --port 8080 --workers $WEB_WORKERS"]
|
||||||
@ -14,7 +14,7 @@ services:
|
|||||||
- ./storage:/usr/src/app/storage
|
- ./storage:/usr/src/app/storage
|
||||||
- ./logs:/usr/src/app/logs
|
- ./logs:/usr/src/app/logs
|
||||||
ports:
|
ports:
|
||||||
- 801:80
|
- 801:8080
|
||||||
networks:
|
networks:
|
||||||
- default
|
- default
|
||||||
# - nginx-proxy-manager_npm_network # Commented for local testing
|
# - nginx-proxy-manager_npm_network # Commented for local testing
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user