eggie5-adyen
commited on
Commit
•
d7a612a
1
Parent(s):
04eb088
updated docker file
Browse files- Dockerfile +17 -9
Dockerfile
CHANGED
@@ -6,20 +6,24 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
6 |
gcc \
|
7 |
python3-dev \
|
8 |
wget \
|
9 |
-
&& rm -rf /var/lib/apt/lists
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
# Set environment variables
|
12 |
ENV PYTHONUNBUFFERED=1
|
13 |
ENV PYTHONIOENCODING=UTF-8
|
14 |
|
15 |
-
# Set working directory in the container
|
16 |
-
WORKDIR /app
|
17 |
|
18 |
-
#
|
19 |
-
COPY requirements.txt
|
|
|
20 |
|
21 |
-
# Install dependencies
|
22 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
23 |
|
24 |
# Install data science packages
|
25 |
RUN pip install --no-cache-dir \
|
@@ -27,9 +31,13 @@ RUN pip install --no-cache-dir \
|
|
27 |
scikit-learn \
|
28 |
matplotlib \
|
29 |
seaborn
|
|
|
|
|
|
|
|
|
30 |
|
31 |
-
# Copy
|
32 |
-
COPY . /app
|
33 |
|
34 |
RUN chmod +x /app/download_data.sh
|
35 |
RUN /app/download_data.sh
|
|
|
6 |
gcc \
|
7 |
python3-dev \
|
8 |
wget \
|
9 |
+
&& rm -rf /var/lib/apt/lists
|
10 |
+
|
11 |
+
|
12 |
+
# Create non-root user
|
13 |
+
RUN useradd -m -u 1000 user
|
14 |
+
USER user
|
15 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
16 |
+
WORKDIR /app
|
17 |
|
18 |
# Set environment variables
|
19 |
ENV PYTHONUNBUFFERED=1
|
20 |
ENV PYTHONIOENCODING=UTF-8
|
21 |
|
|
|
|
|
22 |
|
23 |
+
# Install Python dependencies in layers for better caching
|
24 |
+
COPY --chown=user ./requirements.txt requirements.txt
|
25 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
26 |
|
|
|
|
|
27 |
|
28 |
# Install data science packages
|
29 |
RUN pip install --no-cache-dir \
|
|
|
31 |
scikit-learn \
|
32 |
matplotlib \
|
33 |
seaborn
|
34 |
+
|
35 |
+
|
36 |
+
# Setup IPython kernel
|
37 |
+
RUN ipython kernel install --name "python3" --user
|
38 |
|
39 |
+
# Copy application code
|
40 |
+
COPY --chown=user . /app
|
41 |
|
42 |
RUN chmod +x /app/download_data.sh
|
43 |
RUN /app/download_data.sh
|