File size: 862 Bytes
dc1cb06
10a4ac6
 
dc1cb06
06d5d04
dc1cb06
 
06d5d04
dc1cb06
 
06d5d04
 
10a4ac6
dc1cb06
06d5d04
 
dc1cb06
 
 
 
 
 
 
 
 
 
 
10a4ac6
 
 
dc1cb06
 
 
10a4ac6
dc1cb06
10a4ac6
dc1cb06
a2b20b8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Base Image
FROM python:3.9

# Create a user
RUN useradd -m -u 1000 user

# Switch to user
USER user

# Set environment variables
ENV HOME=/home/user \
	PATH=/home/user/.local/bin:$PATH

# Set working directory
WORKDIR $HOME/app

# Switch back to root to install dependencies
USER root

# Copy requirements and install dependencies
COPY ./requirements.txt /code/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt

# Copy the JSON file and set permissions
COPY --chown=user ./fruitful_patterns.json $HOME/app/fruitful_patterns.json
RUN chmod 644 $HOME/app/fruitful_patterns.json

# Download spaCy model
RUN python -m spacy download en_core_web_md

# Switch to user
USER user

# Copy the rest of the code
COPY --chown=user . $HOME/app

# Set CMD
CMD ["streamlit", "run", "app.py", "--server.address=0.0.0.0", "--server.port=7860"]