lydianish commited on
Commit
6eb33c6
·
verified ·
1 Parent(s): 0b1573b

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +23 -17
Dockerfile CHANGED
@@ -1,10 +1,11 @@
1
  # Use a base image with Conda installed
2
- # FROM centos:7
3
- FROM python:3.9.18
4
  FROM continuumio/miniconda3:latest
5
 
 
 
 
6
  WORKDIR /app
7
- COPY *requirements.txt /app/
8
 
9
  # Clone the RoLASER repository into the container
10
  RUN apt-get update && \
@@ -13,9 +14,14 @@ RUN apt-get update && \
13
  apt-get install -y git && \
14
  git clone https://github.com/lydianish/RoLASER.git /app/RoLASER
15
 
16
- # Create conda environment with the required Python and GCC versions
 
 
 
17
  WORKDIR /app/RoLASER
18
- COPY environment.yml /app/RoLASER/environment.yml
 
 
19
  RUN conda env create -f environment.yml
20
  RUN echo "conda activate rolaser_env" >> ~/.bashrc
21
  ENV PATH /opt/conda/envs/rolaser_env/bin:$PATH
@@ -23,22 +29,26 @@ ENV ROLASER /app/RoLASER
23
 
24
  # Install PyTorch 1.10.1
25
  RUN pip3 install --no-cache-dir torch==1.10.1 torchvision==0.11.2 torchaudio==0.10.1 -f https://download.pytorch.org/whl/cu102/torch_stable.html
 
26
  # Install Fairseq and dependencies
27
- RUN git clone https://github.com/lydianish/fairseq.git /app/fairseq
 
 
 
 
 
 
28
  WORKDIR /app/fairseq
29
- RUN git checkout rolaser
30
- RUN pip3 install --no-cache-dir --editable .
31
- RUN python3 setup.py build_ext --inplace
32
- RUN pip3 install --no-cache-dir -r /app/FAIRSEQ_requirements.txt
33
  ENV FAIRSEQ /app/fairseq
34
 
35
  # Install LASER and dependencies
36
  RUN git clone https://github.com/lydianish/LASER.git /app/LASER
37
  WORKDIR /app/LASER
38
- RUN git checkout rolaser
39
  ENV LASER /app/LASER
40
- RUN bash ./install_external_tools.sh
41
- RUN pip3 install --no-cache-dir -r /app/LASER_requirements.txt
 
 
42
 
43
  # Install other RoLASER dependencies
44
  WORKDIR /app/RoLASER
@@ -61,10 +71,6 @@ RUN mkdir $LASER/models \
61
  ENV PYTHONPATH $PYTHONPATH:$FAIRSEQ
62
  ENV PYTHONPATH $PYTHONPATH:$LASER/source
63
 
64
- # Set up a new user named "user" with user ID 1000
65
- RUN useradd -m -u 1000 user
66
- # Switch to the "user" user
67
- USER user
68
  # Set home to the user's home directory
69
  ENV HOME /home/user
70
  ENV PATH $HOME/.local/bin:$PATH
 
1
  # Use a base image with Conda installed
 
 
2
  FROM continuumio/miniconda3:latest
3
 
4
+ # Create a non-root user named "user" with user ID 1000
5
+ RUN useradd -m -u 1000 user
6
+
7
  WORKDIR /app
8
+ COPY --chown=user *requirements.txt /app/
9
 
10
  # Clone the RoLASER repository into the container
11
  RUN apt-get update && \
 
14
  apt-get install -y git && \
15
  git clone https://github.com/lydianish/RoLASER.git /app/RoLASER
16
 
17
+ # Switch to the non-root user
18
+ USER user
19
+
20
+ # Clone the RoLASER repository into the container
21
  WORKDIR /app/RoLASER
22
+
23
+ # Create conda environment with the required Python and GCC versions
24
+ COPY --chown=user environment.yml /app/RoLASER/environment.yml
25
  RUN conda env create -f environment.yml
26
  RUN echo "conda activate rolaser_env" >> ~/.bashrc
27
  ENV PATH /opt/conda/envs/rolaser_env/bin:$PATH
 
29
 
30
  # Install PyTorch 1.10.1
31
  RUN pip3 install --no-cache-dir torch==1.10.1 torchvision==0.11.2 torchaudio==0.10.1 -f https://download.pytorch.org/whl/cu102/torch_stable.html
32
+
33
  # Install Fairseq and dependencies
34
+ RUN git clone https://github.com/lydianish/fairseq.git /app/fairseq \
35
+ && cd /app/fairseq \
36
+ && git checkout rolaser \
37
+ && pip3 install --no-cache-dir --editable . \
38
+ && python3 setup.py build_ext --inplace \
39
+ && pip3 install --no-cache-dir -r /app/FAIRSEQ_requirements.txt
40
+
41
  WORKDIR /app/fairseq
 
 
 
 
42
  ENV FAIRSEQ /app/fairseq
43
 
44
  # Install LASER and dependencies
45
  RUN git clone https://github.com/lydianish/LASER.git /app/LASER
46
  WORKDIR /app/LASER
 
47
  ENV LASER /app/LASER
48
+
49
+ RUN git checkout rolaser \
50
+ && bash ./install_external_tools.sh \
51
+ && pip3 install --no-cache-dir -r /app/LASER_requirements.txt
52
 
53
  # Install other RoLASER dependencies
54
  WORKDIR /app/RoLASER
 
71
  ENV PYTHONPATH $PYTHONPATH:$FAIRSEQ
72
  ENV PYTHONPATH $PYTHONPATH:$LASER/source
73
 
 
 
 
 
74
  # Set home to the user's home directory
75
  ENV HOME /home/user
76
  ENV PATH $HOME/.local/bin:$PATH