Skip to content

Commit

Permalink
Setup proper directory permission in dockerfile and mark volume
Browse files Browse the repository at this point in the history
  • Loading branch information
aahnik committed Dec 30, 2024
1 parent 241fcf9 commit 007e28a
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ WORKDIR /app
# Install system dependencies and clean up in one layer
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libpq5 \
curl \
postgresql-client \
libpq5 \
curl \
postgresql-client \
&& rm -rf /var/lib/apt/lists/*

# Install Python dependencies
Expand All @@ -32,14 +32,22 @@ COPY . .
# Make entrypoint script executable
RUN chmod +x /app/entrypoint.sh


# Create a non-root user
RUN useradd -m appuser && chown -R appuser:appuser /app

# Create data directory with correct permissions
RUN mkdir -p /data && \
chown -R appuser:appuser /data

USER appuser

# Add healthcheck
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8000/health/ || exit 1

VOLUME ["/data"]

# Expose port
EXPOSE 8000

Expand Down

0 comments on commit 007e28a

Please sign in to comment.