# # Use the official lightweight Python image. # # https://hub.docker.com/_/python # FROM python:3.7 # # Allow statements and log messages to immediately appear in the Knative logs # ENV PYTHONUNBUFFERED True # EXPOSE 8080 # # Copy local code to the container image. # ENV APP_HOME /app # WORKDIR $APP_HOME # COPY . ./ # # Install production dependencies. # RUN pip install -r requirements.txt # # Run the web service on container startup. Here we use the gunicorn # # webserver, with one worker process and 8 threads. # # For environments with multiple CPU cores, increase the number of workers # # to be equal to the cores available. # # Timeout is set to 0 to disable the timeouts of the workers to allow Cloud Run to handle instance scaling. # CMD streamlit run --server.port 8080 --server.enableCORS false app.py FROM python:3.7 RUN pip install virtualenv ENV VIRTUAL_ENV=/venv RUN virtualenv venv -p python3 ENV PATH="VIRTUAL_ENV/bin:$PATH" WORKDIR /app ADD . /app # Install dependencies RUN pip install -r requirements.txt # copying all files over COPY . /app # Expose port ENV PORT 8501 # cmd to launch app when container is run CMD streamlit run app.py # streamlit-specific commands for config ENV LC_ALL=C.UTF-8 ENV LANG=C.UTF-8 RUN mkdir -p /root/.streamlit RUN bash -c 'echo -e "\ [general]\n\ email = \"\"\n\ " > /root/.streamlit/credentials.toml' RUN bash -c 'echo -e "\ [server]\n\ enableCORS = false\n\ " > /root/.streamlit/config.toml'