Basic dockerfile for deploying on EC2

Hey all,

Here is a basic template that works for deploying a docker container with streamlit running on port 80 for EC2. I know it would have helped me coming from zero docker knowledge. Some of the imports are probably not necessary. If people are interested I can also post the docker compose file I use to bring the app up and down as well as the bash scripts I use to update the app in ECR.

FROM ubuntu:20.04
ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update -y --fix-missing && apt-get upgrade -y
RUN apt-get install -y \
   build-essential \
   bzip2 \
   ca-certificates \
   chrpath \
   curl \
   diffstat \
   gawk \
   git \
   gcc \
   jq \
   linux-headers-generic \
   libncurses5-dev \
   libsm6 \
#    libsystemd-dev \
   libxext6 \
   libxrender1 \
   parted \
   rsync \
   sudo \
   texinfo \
   wget \
   python3-pip \
   kbd \
   && apt-get clean \
   && rm -rf /var/lib/apt/lists/*

COPY . .
COPY requirements.txt requirements.txt

RUN ls

RUN pip install -r requirements.txt

ENV PORT 8501
ENV PORT 80

CMD ["streamlit", "run", "main_gui.py", "--server.port", "80"]
2 Likes