-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (27 loc) · 916 Bytes
/
Dockerfile
File metadata and controls
38 lines (27 loc) · 916 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Use Python 3.12 as the base image
FROM python:3.12-slim
# Set working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Copy project files
COPY . /app/
# Install Python dependencies
RUN python -m pip install --no-cache-dir --upgrade pip \
&& python -m pip install --no-cache-dir .
# Set environment variables
ENV PYTHONUNBUFFERED=1
# Create a non-root user with UID 1000
RUN groupadd -r -g 1000 appuser && useradd -r -g appuser -u 1000 -m appuser
# Set the HOME environment variable for the appuser
ENV HOME=/home/appuser
# Make the run script executable
RUN chmod +x /app/run.sh
# Change ownership of the entire app directory to the appuser
RUN chown -R appuser:appuser /app
# Switch to the non-root user
USER appuser
# Set the entry point to use the wrapper script
ENTRYPOINT ["/app/run.sh"]