Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +27 -21
Dockerfile
CHANGED
@@ -1,35 +1,41 @@
|
|
1 |
-
|
|
|
2 |
|
3 |
-
#
|
4 |
-
RUN
|
|
|
5 |
|
6 |
-
# Set
|
7 |
WORKDIR /code
|
8 |
|
9 |
-
# Copy
|
10 |
COPY ./requirements.txt /code/requirements.txt
|
|
|
|
|
11 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
12 |
|
13 |
-
#
|
14 |
-
|
|
|
|
|
|
|
15 |
|
16 |
-
#
|
17 |
-
|
18 |
|
19 |
-
#
|
20 |
-
|
|
|
21 |
|
22 |
-
#
|
23 |
-
|
|
|
24 |
|
25 |
-
#
|
26 |
-
|
27 |
-
echo "git clone https://\${gh_token}@github.com/Eslam-Magdy-1297/ESearch_FletV01.git /code/ESearch_FletV01" >> clone_repo.sh && \
|
28 |
-
chmod +x clone_repo.sh && \
|
29 |
-
./clone_repo.sh
|
30 |
|
31 |
-
#
|
32 |
-
|
33 |
|
34 |
-
#
|
35 |
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
1 |
+
# Stage 1: Build stage
|
2 |
+
FROM python:3.9 AS builder
|
3 |
|
4 |
+
# Install git
|
5 |
+
RUN apt-get update && \
|
6 |
+
apt-get install -y git
|
7 |
|
8 |
+
# Set working directory
|
9 |
WORKDIR /code
|
10 |
|
11 |
+
# Copy requirements file
|
12 |
COPY ./requirements.txt /code/requirements.txt
|
13 |
+
|
14 |
+
# Install Python dependencies
|
15 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
16 |
|
17 |
+
# Stage 2: Runtime stage
|
18 |
+
FROM python:3.9
|
19 |
+
|
20 |
+
# Set working directory
|
21 |
+
WORKDIR /code
|
22 |
|
23 |
+
# Copy from the builder stage
|
24 |
+
COPY --from=builder /code /code
|
25 |
|
26 |
+
# Set environment variable for GitHub token (replace with your actual token)
|
27 |
+
ARG GH_TOKEN
|
28 |
+
ENV gh_token=${GH_TOKEN}
|
29 |
|
30 |
+
# Clone your repository using the token
|
31 |
+
RUN url_with_token="https://[email protected]/yourusername/your-repo.git" && \
|
32 |
+
git clone $url_with_token /code
|
33 |
|
34 |
+
# Set the working directory to your cloned repository
|
35 |
+
WORKDIR /code
|
|
|
|
|
|
|
36 |
|
37 |
+
# Install remaining dependencies (if any)
|
38 |
+
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
39 |
|
40 |
+
# Command to run your application
|
41 |
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|