-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContainerfile
More file actions
70 lines (56 loc) · 2.84 KB
/
Copy pathContainerfile
File metadata and controls
70 lines (56 loc) · 2.84 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# OCI-compliant Containerfile for FIPS Chat
# Multi-provider AI chat platform optimized for OpenShift with FIPS mode support
FROM registry.access.redhat.com/ubi9/python-311:latest
# Set environment variables for FIPS compliance
ENV OPENSSL_FIPS=1 \
OPENSSL_FORCE_FIPS_MODE=1
# Container metadata following OCI spec
LABEL name="fips-chat" \
version="1.0.0" \
description="Multi-provider AI chat and image analysis platform" \
maintainer="Development Team" \
vendor="Organization" \
io.k8s.description="Multi-provider AI chat platform supporting Ollama, vLLM, and other APIs" \
io.k8s.display-name="FIPS Chat" \
io.openshift.tags="streamlit,ai,chat,vllm,ollama,openai,python"
# The UBI9 Python image already has a user with UID 1001, so we'll use it
USER 0
# Set working directory
WORKDIR /opt/app-root/src
# Copy requirements first for better layer caching
COPY --chown=1001:1001 requirements.txt ./
# Install Python dependencies with FIPS-compatible settings
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY --chown=1001:1001 . ./
# Create necessary directories with proper permissions
RUN mkdir -p /opt/app-root/src/.streamlit && \
chown -R 1001:1001 /opt/app-root/src
# Switch to non-root user
USER 1001
# Create Streamlit config file for production
RUN echo '[server]' > /opt/app-root/src/.streamlit/config.toml && \
echo 'port = 8080' >> /opt/app-root/src/.streamlit/config.toml && \
echo 'address = "0.0.0.0"' >> /opt/app-root/src/.streamlit/config.toml && \
echo 'enableCORS = false' >> /opt/app-root/src/.streamlit/config.toml && \
echo 'enableXsrfProtection = true' >> /opt/app-root/src/.streamlit/config.toml && \
echo 'maxUploadSize = 10' >> /opt/app-root/src/.streamlit/config.toml && \
echo '' >> /opt/app-root/src/.streamlit/config.toml && \
echo '[browser]' >> /opt/app-root/src/.streamlit/config.toml && \
echo 'gatherUsageStats = false' >> /opt/app-root/src/.streamlit/config.toml && \
echo 'showErrorDetails = false' >> /opt/app-root/src/.streamlit/config.toml && \
echo '' >> /opt/app-root/src/.streamlit/config.toml && \
echo '[logger]' >> /opt/app-root/src/.streamlit/config.toml && \
echo 'level = "info"' >> /opt/app-root/src/.streamlit/config.toml && \
echo '' >> /opt/app-root/src/.streamlit/config.toml && \
echo '[client]' >> /opt/app-root/src/.streamlit/config.toml && \
echo 'toolbarMode = "minimal"' >> /opt/app-root/src/.streamlit/config.toml
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8080/_stcore/health || exit 1
# Expose port
EXPOSE 8080
# Set entrypoint and command
ENTRYPOINT ["streamlit", "run"]
CMD ["app.py", "--server.port=8080", "--server.address=0.0.0.0", "--server.headless=true"]