Skip to content

Commit bb5f525

Browse files
committed
refactor(infra): update Dockerfile and requirements for Streamlit app
when trying to deploy the copilot streamlit service, the image build would fail because caltrans/pems:app was not available to the AWS environment. So we now build the streamlit image just using its own Dockerfile.
1 parent 7f40188 commit bb5f525

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

streamlit_app/Dockerfile

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,33 @@
1-
FROM caltrans/pems:app
1+
ARG PYTHON_VERSION=3.12
2+
3+
FROM python:${PYTHON_VERSION}
4+
5+
ENV PYTHONDONTWRITEBYTECODE=1 \
6+
PYTHONUNBUFFERED=1 \
7+
USER=caltrans
8+
9+
# create non-root $USER and home directory
10+
RUN useradd --create-home --shell /bin/bash $USER && \
11+
# setup directories and permissions
12+
mkdir -p /$USER/app && \
13+
chown -R $USER:$USER /$USER
14+
15+
# enter source directory
16+
WORKDIR /$USER
17+
18+
COPY LICENSE app/LICENSE
19+
20+
# switch to non-root $USER
21+
USER $USER
22+
23+
# update env for local pip installs
24+
# see https://docs.python.org/3/using/cmdline.html#envvar-PYTHONUSERBASE
25+
# since all `pip install` commands are in the context of $USER
26+
# $PYTHONUSERBASE is the location used by default
27+
ENV PATH="$PATH:/$USER/.local/bin" \
28+
PYTHONUSERBASE="/$USER/.local"
29+
30+
WORKDIR /$USER/app
231

332
ENV PYTHONPATH="$PYTHONPATH:/$USER/app"
433

streamlit_app/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
django==5.1.6
12
pandas==2.2.3
23
pygwalker==0.4.9.15
34
streamlit==1.44.1

0 commit comments

Comments
 (0)