Spaces:
Running
Running
BinaryONe
commited on
Commit
·
cc4f142
1
Parent(s):
869bfd6
Nginx Changes-Over Alpine
Browse files- Dockerfile +14 -13
Dockerfile
CHANGED
@@ -1,8 +1,17 @@
|
|
1 |
-
FROM
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
# Create and use a non-root user
|
4 |
RUN useradd -ms /bin/bash appuser
|
5 |
|
|
|
|
|
|
|
|
|
6 |
# Set working directory for the application
|
7 |
WORKDIR /app
|
8 |
|
@@ -10,10 +19,10 @@ WORKDIR /app
|
|
10 |
COPY requirements.txt /app/requirements.txt
|
11 |
|
12 |
# Install system dependencies and clean up in a single RUN step to reduce layers
|
13 |
-
RUN apt-get update -y && apt-get upgrade -y \
|
14 |
-
&& apt-get install -y \
|
15 |
-
&& apt-get clean \
|
16 |
-
&& rm -rf /var/lib/apt/lists/*
|
17 |
|
18 |
# Install Python dependencies from the requirements file
|
19 |
RUN pip3 install --no-cache-dir --upgrade -r requirements.txt
|
@@ -21,16 +30,8 @@ RUN pip3 install --no-cache-dir --upgrade -r requirements.txt
|
|
21 |
# Copy the rest of the application code after installing dependencies for better cache
|
22 |
COPY . /app
|
23 |
|
24 |
-
FROM nginx:alpine
|
25 |
-
|
26 |
-
COPY --from=builder /app /app
|
27 |
-
|
28 |
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
29 |
|
30 |
-
# Create a non-root user and group
|
31 |
-
#RUN addgroup -S appgroup && adduser -S appuser -G appgroup
|
32 |
-
RUN addgroup appgroup && adduser -G appgroup appuser
|
33 |
-
|
34 |
WORKDIR /app
|
35 |
|
36 |
RUN chown -R appuser:appgroup /app
|
|
|
1 |
+
FROM alpine:latest
|
2 |
+
|
3 |
+
# Install system dependencies
|
4 |
+
RUN apk update && apk upgrade && \
|
5 |
+
apk add --no-cache nginx python3 py3-pip build-base libffi-dev openssl-dev
|
6 |
+
|
7 |
|
8 |
# Create and use a non-root user
|
9 |
RUN useradd -ms /bin/bash appuser
|
10 |
|
11 |
+
# Create a non-root user and group
|
12 |
+
RUN addgroup appgroup && adduser -G appgroup appuser
|
13 |
+
|
14 |
+
|
15 |
# Set working directory for the application
|
16 |
WORKDIR /app
|
17 |
|
|
|
19 |
COPY requirements.txt /app/requirements.txt
|
20 |
|
21 |
# Install system dependencies and clean up in a single RUN step to reduce layers
|
22 |
+
#RUN apt-get update -y && apt-get upgrade -y \
|
23 |
+
# && apt-get install -y \
|
24 |
+
# && apt-get clean \
|
25 |
+
# && rm -rf /var/lib/apt/lists/*
|
26 |
|
27 |
# Install Python dependencies from the requirements file
|
28 |
RUN pip3 install --no-cache-dir --upgrade -r requirements.txt
|
|
|
30 |
# Copy the rest of the application code after installing dependencies for better cache
|
31 |
COPY . /app
|
32 |
|
|
|
|
|
|
|
|
|
33 |
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
34 |
|
|
|
|
|
|
|
|
|
35 |
WORKDIR /app
|
36 |
|
37 |
RUN chown -R appuser:appgroup /app
|