Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +12 -19
Dockerfile
CHANGED
@@ -1,11 +1,8 @@
|
|
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
|
9 |
|
10 |
# Clone the RoLASER repository into the container
|
11 |
RUN apt-get update && \
|
@@ -20,10 +17,11 @@ RUN apt-get update && \
|
|
20 |
WORKDIR /app/RoLASER
|
21 |
|
22 |
# Create conda environment with the required Python and GCC versions
|
23 |
-
COPY
|
24 |
-
RUN conda env create -f environment.yml \
|
25 |
-
|
26 |
ENV PATH /opt/conda/envs/rolaser_env/bin:$PATH
|
|
|
27 |
|
28 |
# Install PyTorch 1.10.1
|
29 |
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
|
@@ -35,41 +33,36 @@ RUN git clone https://github.com/lydianish/fairseq.git /app/fairseq && \
|
|
35 |
pip3 install --no-cache-dir --editable . && \
|
36 |
python3 setup.py build_ext --inplace && \
|
37 |
pip3 install --no-cache-dir -r /app/FAIRSEQ_requirements.txt
|
38 |
-
|
39 |
-
WORKDIR /app/fairseq
|
40 |
ENV FAIRSEQ /app/fairseq
|
41 |
|
42 |
# Install LASER and dependencies
|
43 |
RUN git clone https://github.com/lydianish/LASER.git /app/LASER
|
44 |
WORKDIR /app/LASER
|
45 |
ENV LASER /app/LASER
|
46 |
-
|
47 |
RUN git checkout rolaser && \
|
48 |
bash ./install_external_tools.sh && \
|
49 |
-
|
50 |
|
51 |
# Install other RoLASER dependencies
|
52 |
WORKDIR /app/RoLASER
|
53 |
RUN pip3 install --no-cache-dir -r /app/ROLASER_requirements.txt
|
54 |
-
ENV ROLASER /app/RoLASER
|
55 |
|
56 |
# Download models
|
57 |
WORKDIR /app/RoLASER/models
|
58 |
RUN wget https://zenodo.org/api/records/10864557/files-archive && \
|
59 |
unzip files-archive && \
|
|
|
|
|
60 |
rm files-archive
|
61 |
-
COPY --chown=user:user . /app/RoLASER/models
|
62 |
-
|
63 |
-
RUN mkdir $LASER/models && \
|
64 |
-
mv laser* $LASER/models
|
65 |
-
|
66 |
-
WORKDIR /app/LASER/models
|
67 |
-
COPY --chown=user:user . /app/LASER/models/
|
68 |
|
69 |
# Set Python system path to find the Fairseq and LASER modules
|
70 |
ENV PYTHONPATH $PYTHONPATH:$FAIRSEQ
|
71 |
ENV PYTHONPATH $PYTHONPATH:$LASER/source
|
72 |
|
|
|
|
|
|
|
|
|
73 |
# Switch to the non-root user
|
74 |
USER user
|
75 |
# Set home to the user's home directory
|
|
|
1 |
# Use a base image with Conda installed
|
2 |
FROM continuumio/miniconda3:latest
|
3 |
|
|
|
|
|
|
|
4 |
WORKDIR /app
|
5 |
+
COPY *requirements.txt /app/
|
6 |
|
7 |
# Clone the RoLASER repository into the container
|
8 |
RUN apt-get update && \
|
|
|
17 |
WORKDIR /app/RoLASER
|
18 |
|
19 |
# Create conda environment with the required Python and GCC versions
|
20 |
+
COPY environment.yml /app/RoLASER/environment.yml
|
21 |
+
RUN conda env create -f environment.yml && \
|
22 |
+
echo "conda activate rolaser_env" >> ~/.bashrc
|
23 |
ENV PATH /opt/conda/envs/rolaser_env/bin:$PATH
|
24 |
+
ENV ROLASER /app/RoLASER
|
25 |
|
26 |
# Install PyTorch 1.10.1
|
27 |
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
|
|
|
33 |
pip3 install --no-cache-dir --editable . && \
|
34 |
python3 setup.py build_ext --inplace && \
|
35 |
pip3 install --no-cache-dir -r /app/FAIRSEQ_requirements.txt
|
|
|
|
|
36 |
ENV FAIRSEQ /app/fairseq
|
37 |
|
38 |
# Install LASER and dependencies
|
39 |
RUN git clone https://github.com/lydianish/LASER.git /app/LASER
|
40 |
WORKDIR /app/LASER
|
41 |
ENV LASER /app/LASER
|
|
|
42 |
RUN git checkout rolaser && \
|
43 |
bash ./install_external_tools.sh && \
|
44 |
+
pip3 install --no-cache-dir -r /app/LASER_requirements.txt
|
45 |
|
46 |
# Install other RoLASER dependencies
|
47 |
WORKDIR /app/RoLASER
|
48 |
RUN pip3 install --no-cache-dir -r /app/ROLASER_requirements.txt
|
|
|
49 |
|
50 |
# Download models
|
51 |
WORKDIR /app/RoLASER/models
|
52 |
RUN wget https://zenodo.org/api/records/10864557/files-archive && \
|
53 |
unzip files-archive && \
|
54 |
+
mkdir $LASER/models && \
|
55 |
+
mv laser* $LASER/models && \
|
56 |
rm files-archive
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
|
58 |
# Set Python system path to find the Fairseq and LASER modules
|
59 |
ENV PYTHONPATH $PYTHONPATH:$FAIRSEQ
|
60 |
ENV PYTHONPATH $PYTHONPATH:$LASER/source
|
61 |
|
62 |
+
# Create a non-root user named "user" with user ID 1000
|
63 |
+
RUN useradd -m -u 1000 user
|
64 |
+
RUN chown user:user -R /app/
|
65 |
+
|
66 |
# Switch to the non-root user
|
67 |
USER user
|
68 |
# Set home to the user's home directory
|