Update Dockerfile
Browse files- Dockerfile +12 -16
Dockerfile
CHANGED
@@ -1,28 +1,24 @@
|
|
1 |
-
#
|
2 |
-
# you will also find guides on how best to write your Dockerfile
|
3 |
-
|
4 |
FROM python:3.9
|
5 |
|
|
|
6 |
WORKDIR /code
|
7 |
|
|
|
8 |
COPY ./requirements.txt /code/requirements.txt
|
9 |
|
|
|
10 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
11 |
|
12 |
-
|
13 |
COPY . .
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
git
|
18 |
-
|
19 |
-
|
20 |
-
git
|
21 |
-
git remote add origin $(cat /run/secrets/private_key)
|
22 |
-
|
23 |
-
RUN --mount=type=secret,id=url_endpoint,mode=0444,required=true \
|
24 |
-
git init && \
|
25 |
-
git remote add origin $(cat /run/secrets/url_endpoint)
|
26 |
-
|
27 |
|
|
|
28 |
CMD ["python", "app.py"]
|
|
|
1 |
+
# Use Python 3.9 image as the base image
|
|
|
|
|
2 |
FROM python:3.9
|
3 |
|
4 |
+
# Set the working directory in the container to /code
|
5 |
WORKDIR /code
|
6 |
|
7 |
+
# Copy the requirements.txt file into the container at /code
|
8 |
COPY ./requirements.txt /code/requirements.txt
|
9 |
|
10 |
+
# Install the Python dependencies
|
11 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
12 |
|
13 |
+
# Copy the rest of your application's code into the container
|
14 |
COPY . .
|
15 |
|
16 |
+
# Initialize a Git repository and set up remotes with secrets
|
17 |
+
# Note: Replace 'remote1', 'remote2', and 'remote3' with appropriate remote names
|
18 |
+
RUN git init && \
|
19 |
+
--mount=type=secret,id=public_key,mode=0444,required=true git remote add remote1 $(cat /run/secrets/public_key) && \
|
20 |
+
--mount=type=secret,id=private_key,mode=0444,required=true git remote add remote2 $(cat /run/secrets/private_key) && \
|
21 |
+
--mount=type=secret,id=url_endpoint,mode=0444,required=true git remote add remote3 $(cat /run/secrets/url_endpoint)
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
+
# Specify the command to run on container start
|
24 |
CMD ["python", "app.py"]
|