Spaces:
Running
Running
James McCool
commited on
Commit
·
b4c7834
1
Parent(s):
d18edc5
Refactor Dockerfile to improve secret handling by replacing the previous git clone command with git initialization and remote setup using the MongoDB URI secret. Additionally, ensure requirements are installed after copying the requirements file.
Browse files- Dockerfile +5 -7
Dockerfile
CHANGED
@@ -9,17 +9,15 @@ RUN apt-get update && apt-get install -y \
|
|
9 |
git \
|
10 |
&& rm -rf /var/lib/apt/lists/*
|
11 |
|
|
|
|
|
12 |
COPY requirements.txt ./
|
13 |
COPY src/ ./src/
|
14 |
|
|
|
15 |
RUN --mount=type=secret,id=mongo_uri,mode=0444,required=true \
|
16 |
-
|
17 |
-
|
18 |
-
# Get secret SECRET_EXAMPLE and clone it as repo at buildtime
|
19 |
-
RUN --mount=type=secret,id=mongo_uri,mode=0444,required=true \
|
20 |
-
git clone $(cat /run/secrets/mongo_uri)
|
21 |
-
|
22 |
-
RUN pip3 install -r requirements.txt
|
23 |
|
24 |
EXPOSE 8501
|
25 |
|
|
|
9 |
git \
|
10 |
&& rm -rf /var/lib/apt/lists/*
|
11 |
|
12 |
+
RUN pip3 install -r requirements.txt
|
13 |
+
|
14 |
COPY requirements.txt ./
|
15 |
COPY src/ ./src/
|
16 |
|
17 |
+
# Expose the secret SECRET_EXAMPLE at buildtime and use its value as git remote URL
|
18 |
RUN --mount=type=secret,id=mongo_uri,mode=0444,required=true \
|
19 |
+
git init && \
|
20 |
+
git remote add origin $(cat /run/secrets/mongo_uri)
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
EXPOSE 8501
|
23 |
|