-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathContainerfile
More file actions
44 lines (36 loc) · 1.38 KB
/
Containerfile
File metadata and controls
44 lines (36 loc) · 1.38 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
FROM registry.access.redhat.com/ubi9/python-312:latest
WORKDIR /opt/app-root
# Switch to root only for installing packages
USER root
# For Rust-based Python packages
RUN dnf install -y --setopt install_weak_deps=0 --nodocs \
cargo \
rust \
&& dnf clean all
COPY . .
# Build argument to specify architecture
ARG TARGETARCH=x86_64
# # Install dependencies
# RUN if [ "$TARGETARCH" = "amd64" ] || [ "$TARGETARCH" = "x86_64" ]; then \
# echo "Installing x86_64 dependencies ..."; \
# pip install --no-cache-dir -r requirements-x86_64.txt; \
# elif [ "$TARGETARCH" = "arm64" ] || [ "$TARGETARCH" = "aarch64" ]; then \
# echo "Installing ARM64 dependencies ..."; \
# pip install --no-cache-dir -r requirements-aarch64.txt; \
# else \
# echo "ERROR: Unsupported architecture: $TARGETARCH"; \
# exit 1; \
# fi
# Install cpu torch to reduce image size
RUN pip install torch --index-url https://download.pytorch.org/whl/cpu
# Install the package itself
# Use [inline] to get garak dependency
RUN pip install --no-cache-dir ".[inline]"
RUN pip install --no-cache-dir -r requirements-inline-extra.txt
# Set XDG environment variables to use /tmp (always writable) for garak to write to
ENV XDG_CACHE_HOME=/tmp/.cache
ENV XDG_DATA_HOME=/tmp/.local/share
ENV XDG_CONFIG_HOME=/tmp/.config
# Switch back to non-root user
# UBI9 uses 1001
USER 1001