Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save harishkashyap/0a5a3fe0f79ab8bbd592e6d09eb3c562 to your computer and use it in GitHub Desktop.
Save harishkashyap/0a5a3fe0f79ab8bbd592e6d09eb3c562 to your computer and use it in GitHub Desktop.
Dockerfile for Deployment of a Python Module to an EC2 instance
FROM python:3.8-slim
WORKDIR /usr/app/src
RUN pip install --upgrade pip
COPY requirements.txt ./requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
RUN pip install .
EXPOSE 8501
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'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment