Nikita commited on
Commit
e194428
·
1 Parent(s): b8f5692

debugged dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +0 -45
Dockerfile CHANGED
@@ -1,48 +1,3 @@
1
- # 1. Base Image: Start with Miniconda as your project requires it.
2
- FROM continuumio/miniconda3
3
-
4
- # 2. Create Conda Environment:
5
- # First, copy only the environment file and create the environment.
6
- # This is done as root and caches this layer, so it only re-runs if environment.yaml changes.
7
- COPY environment.yaml /tmp/environment.yaml
8
- RUN conda env create -f /tmp/environment.yaml
9
-
10
- # 3. Create a Non-Root User:
11
- # As shown in your example, we create a dedicated, non-root user to run the application.
12
- # This is a critical security and permissions best practice.
13
- RUN useradd -m -u 1000 user
14
-
15
- # 4. Copy Application Code:
16
- # Copy the rest of your application code into the user's home directory.
17
- # The `--chown=user:user` flag sets the correct ownership at the same time,
18
- # which is more efficient and cleaner than a separate `chown` command.
19
- COPY --chown=user:user . /home/user/app
20
-
21
- # 5. Switch to Non-Root User:
22
- # From this point on, all commands will be run as 'user'.
23
- USER user
24
-
25
- # 6. Set Working Directory:
26
- # Set the working directory to where the code was copied.
27
- WORKDIR /home/user/app
28
-
29
- # 7. Expose Port:
30
- # Expose the port your Gradio app will run on.
31
- EXPOSE 7860
32
-
33
- # 8. Run the Application:
34
- # Use the `conda run` command to execute your app within the 'tirex' environment.
35
- # Because we are now running as 'user', any libraries that need to write to a cache
36
- # (like Hugging Face, Matplotlib, or PyTorch) will do so inside `/home/user/.cache`,
37
- # which is writable by 'user', completely solving all previous permission errors.
38
- CMD ["conda", "run", "--no-capture-output", "-n", "tirex", "python", "app.py"]
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
 
47
  # 1. Base Image: Start with Miniconda as your project requires it.
48
  FROM continuumio/miniconda3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
 
2
  # 1. Base Image: Start with Miniconda as your project requires it.
3
  FROM continuumio/miniconda3