-
Notifications
You must be signed in to change notification settings - Fork 5
/
python3.9.dockerfile
40 lines (30 loc) · 1.19 KB
/
python3.9.dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
FROM python:3.9-slim
LABEL maintainer="Luca Ballore <luca@lucaballore.com>"
USER root
# System deps
RUN apt-get -qq update && \
apt-get -y install wget gnupg && \
wget https://nginx.org/keys/nginx_signing.key && \
cat nginx_signing.key | apt-key add - && \
apt-get -qq update && \
apt-get -y install nginx && \
rm nginx_signing.key && \
rm -rf /var/lib/apt/lists/*
# Python deps
COPY ./requirements.txt /tmp/requirements.txt
RUN pip install -r /tmp/requirements.txt --no-cache-dir --timeout 1000
# User settings
RUN useradd -m -u 1000 -d /home/streamlitapp streamlitapp
RUN chown -R streamlitapp /var/log/nginx /var/lib/nginx
# Config and exec files
COPY --chown=streamlitapp ./config/nginx /home/streamlitapp/.nginx/
COPY --chown=streamlitapp ./config/streamlit /home/streamlitapp/.streamlit/
COPY --chown=streamlitapp ./bin /home/streamlitapp/bin/
# Paths
ENV PYTHONPATH "${PYTHONPATH}:/home/streamlitapp/src"
ENV PATH "${PATH}:/home/streamlitapp/src/bin:/home/streamlitapp/src/server/bin"
WORKDIR /home/streamlitapp
USER streamlitapp
RUN ["chmod", "+x", "/home/streamlitapp/bin/start-nginx.sh"]
ENTRYPOINT ["/home/streamlitapp/bin/start-nginx.sh"]
CMD ["streamlit", "hello"]