Sign inSign up

it360id/python311-slim-streamlit-pyarrow-numpy-sudoer

By it360id

Updated over 1 year ago

python - streamlit - pyarrow - numpy

Image
0

133

it360id/python311-slim-streamlit-pyarrow-numpy-sudoer repository overview

Assets:

python:3.11-slim
streamlit==1.22.0
pyarrow==13.0.0
numpy==1.24.4

Dockerfile

FROM python:3.11-slim
LABEL maintainer="Bli Dane <[email protected]>"

RUN apt-get update && \
    apt-get install -y sudo && \
    rm -rf /var/lib/apt/lists/*

RUN useradd -m python && \
    echo "python ALL=(ALL) ALL" >> /etc/sudoers && \
    echo "python ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers

USER python
WORKDIR /home/python

COPY --chown=python:python requirements.txt .

RUN sudo pip install --upgrade pip && \
    sudo pip install --no-cache-dir -r requirements.txt && \
    sudo rm -f requirements.txt Dockerfile

Untuk penggunaan: Dockerfile

# Base image
FROM my-streamlit-app-user-images:latest

# Switch to the 'python' user
USER python

# Set working directory
WORKDIR /home/python

# Copy the rest of the application code
COPY --chown=python:python . .

# Command to run the Streamlit app
CMD ["streamlit", "run", "app.py"]

contoh app.py

import streamlit as st
import pyarrow as pa

# Set Streamlit configuration (port and address)
st.set_page_config(page_title="Streamlit with PyArrow", layout="wide")

# Configure server port and address
def set_streamlit_config():
    import os
    os.environ["STREAMLIT_SERVER_PORT"] = "8501"
    os.environ["STREAMLIT_SERVER_ADDRESS"] = "0.0.0.0"

set_streamlit_config()

# Main application
st.title("Aplikasi Streamlit dengan PyArrow")

# Contoh penggunaan PyArrow
table = pa.table({'Nama': ['Alice', 'Bob'], 'Umur': [25, 30]})
st.write("Tabel PyArrow:")
st.write(table.to_pandas())

Tag summary

Content type

Image

Digest

sha256:f2e40c020

Size

167.6 MB

Last updated

over 1 year ago

docker pull it360id/python311-slim-streamlit-pyarrow-numpy-sudoer:04032025