File size: 1,811 Bytes
ad0267c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import streamlit as st
from utils import *

st.markdown("# Steps to run streamlit with Docker")

st.image("https://jenkov.com/images/docker/docker-introduction-2.png", width=600,)


st.markdown(
    """
    #### :blue[For MacOS:]
    
    ###### 1. Download Docker Desktop 
    - Check the webside [here](https://docs.docker.com/desktop/install/mac-install/) to download

    ###### 2. Check version

    ```bash
       sudo docker --version
    ```
    ###### 3. Add Docker to path

    ```bash
        export PATH=$PATH:/usr/local/bin/docker
    ```
    ###### 4. Create Dockerfile
    - go to your app directory, touch a file named Dockerfile, then copy the following code and save
 
    ```cmd
    FROM harpershen/aiclububuntu

    RUN apt update
    RUN apt install --assume-yes python3-pip

    WORKDIR /usr/app
    COPY . .

    RUN pip install -r requirements.txt
    CMD [ "streamlit", "run", "app.py"]
    ```

    ###### 5. create requirements.txt
    - at the same app directory, touch a file requirements.txt, then copy the following and save:

    ```cmd
    pandas
    streamlit
    numpy
    matplotlib
    plotly
    nltk
    python-dotenv
    openai
    extra_streamlit_components
    streamlit_book
    spacy_streamlit
    ```

    ###### 6. Build docker image

    - in the Terminal, at the app directory, typing and run:

    ```cmd
    docker build -t streamlit-runner . 
    ```

    ###### 7. Run docker container

    - in the Terminal, at the app directory, typing and run:

    ```cmd
    docker run -d -p 8501:8501 -v .:/usr/app streamlit-runner
    ```

    ###### 8. Further reading on remove/clean image and containers

    - Check the webside [here](https://www.digitalocean.com/community/tutorials/how-to-remove-docker-images-containers-and-volumes/) to learn
    
    """
    )