Update Dockerfile to use Conda environment
Browse filesThis commit updates the Dockerfile to use a base image with Conda installed instead of the official Python runtime. It also adds the ability to create and activate a Conda environment from the environment.yml file. Additionally, it installs any additional dependencies specified in requirements.txt using Conda. This change improves the reproducibility and manageability of the application's dependencies.
- Dockerfile +15 -14
Dockerfile
CHANGED
@@ -1,29 +1,30 @@
|
|
1 |
-
# Use
|
2 |
-
FROM
|
3 |
|
4 |
# Set the working directory in the container
|
5 |
WORKDIR /usr/src/app
|
6 |
|
7 |
-
#
|
8 |
-
|
9 |
|
10 |
-
#
|
11 |
-
RUN
|
12 |
|
13 |
-
|
14 |
-
|
15 |
|
16 |
-
# Copy the
|
17 |
COPY . .
|
18 |
|
19 |
-
# Install any
|
20 |
-
|
|
|
21 |
|
22 |
# Make port 80 available to the world outside this container
|
23 |
EXPOSE 80
|
24 |
|
25 |
-
# Define environment variable
|
26 |
ENV NAME World
|
27 |
|
28 |
-
# Run
|
29 |
-
CMD ["python", "./entry_with_update.py","--preset","realistic"]
|
|
|
1 |
+
# Use a base image with Conda installed
|
2 |
+
FROM continuumio/miniconda3
|
3 |
|
4 |
# Set the working directory in the container
|
5 |
WORKDIR /usr/src/app
|
6 |
|
7 |
+
# Copy the environment.yml file to the container
|
8 |
+
COPY environment.yml ./
|
9 |
|
10 |
+
# Create the Conda environment from the environment.yml file
|
11 |
+
RUN conda env create -f environment.yml && conda clean -afy
|
12 |
|
13 |
+
# Activate the environment
|
14 |
+
SHELL ["conda", "run", "-n", "fooocus", "/bin/bash", "-c"]
|
15 |
|
16 |
+
# Copy the rest of your application's code
|
17 |
COPY . .
|
18 |
|
19 |
+
# Install any additional dependencies specified in requirements.txt
|
20 |
+
# Note: This is only necessary if you have additional pip packages not listed in environment.yml
|
21 |
+
RUN conda run -n fooocus pip install --no-cache-dir -r requirements.txt
|
22 |
|
23 |
# Make port 80 available to the world outside this container
|
24 |
EXPOSE 80
|
25 |
|
26 |
+
# Define environment variable (if needed)
|
27 |
ENV NAME World
|
28 |
|
29 |
+
# Run your application
|
30 |
+
CMD ["conda", "run", "-n", "fooocus", "python", "./entry_with_update.py", "--preset", "realistic"]
|