Skip to content

Instantly share code, notes, and snippets.

@chinmay-sh
Created July 7, 2020 11:32
Show Gist options
  • Save chinmay-sh/732246ffc2a28be05232ccf38f49089f to your computer and use it in GitHub Desktop.
Save chinmay-sh/732246ffc2a28be05232ccf38f49089f to your computer and use it in GitHub Desktop.
Docker container files for streamlit
# Below are all the sections and options you can have in ~/.streamlit/config.toml.
[global]
# Level of logging: 'error', 'warning', 'info', or 'debug'.
# Default: 'info'
logLevel = "debug"
[client]
# Whether to enable st.cache.
# Default: true
caching = true
# If false, makes your Streamlit script not draw to a Streamlit app.
# Default: true
displayEnabled = true
[runner]
# Allows you to type a variable or string by itself in a single line of Python code to write it to the app.
# Default: true
magicEnabled = true
# Install a Python tracer to allow you to stop or pause your script at any point and introspect it. As a side-effect, this slows down your script's execution.
# Default: false
installTracer = false
# Sets the MPLBACKEND environment variable to Agg inside Streamlit to prevent Python crashing.
# Default: true
fixMatplotlib = true
[server]
# List of folders that should not be watched for changes. Relative paths will be taken as relative to the current working directory.
# Example: ['/home/user1/env', 'relative/path/to/folder']
# Default: []
folderWatchBlacklist = ['']
# If false, will attempt to open a browser window on start.
# Default: false unless (1) we are on a Linux box where DISPLAY is unset, or (2) server.liveSave is set.
headless = true
# Immediately share the app in such a way that enables live monitoring, and post-run analysis.
# Default: false
liveSave = false
# Automatically rerun script when the file is modified on disk.
# Default: false
runOnSave = false
# The port where the server will listen for client and browser connections.
# Default: 8501
port = 80
# Enables support for Cross-Origin Request Sharing, for added security.
# Default: true
enableCORS = true
[browser]
# Internet address of the server server that the browser should connect to. Can be IP address or DNS name.
# Default: 'localhost'
serverAddress = "0.0.0.0"
# Whether to send usage statistics to Streamlit.
# Default: true
gatherUsageStats = true
# Port that the browser should use to connect to the server when in liveSave mode.
# Default: whatever value is set in server.port.
serverPort = 80
version: '3'
services:
webapp:
image: image:tag
ports:
- 80:80
FROM python:3.8-slim-buster
WORKDIR /app
COPY requirements.txt /
RUN pip install -r /requirements.txt
COPY . /app
RUN mkdir ~/.streamlit
COPY config.toml ./.streamlit/config.toml
EXPOSE 80
ENTRYPOINT ["streamlit", "run"]
CMD ["app.py"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment