Skip to content

Commit

Permalink
add non-root user
Browse files Browse the repository at this point in the history
  • Loading branch information
vietnguyengit committed Dec 11, 2024
1 parent afc6cf6 commit 7b6e5c0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ FROM python:3.10-slim
# Set the working directory in the container
WORKDIR /app

# Create a non-root user
RUN useradd --create-home appuser

# Copy only necessary files for dependency installation
COPY pyproject.toml poetry.lock ./

Expand All @@ -21,6 +24,12 @@ RUN apt update && \
# Copy the rest of the application code
COPY . /app

# Ensure correct permissions for the non-root user
RUN chown -R appuser:appuser /app

# Switch to the non-root user
USER appuser

# Make sure log config file (if provided) is available in the working directory
COPY log_config.yaml /app/log_config.yaml

Expand Down

0 comments on commit 7b6e5c0

Please sign in to comment.