Files
dissect/Dockerfile
2024-01-30 09:55:31 +01:00

70 lines
1.5 KiB
Docker

# Use Alpine as the base for the builder stage
FROM alpine as builder
# Set Python environment variables
ENV PYTHONDONTWRITEBYTECODE=1
# Add pip configuration (assuming you have a custom pip.conf)
ADD pip.conf /etc/pip.conf
# Set user ID and group ID arguments
ARG PUID=1001
ARG PGID=1001
# Create a user and group
RUN addgroup -g ${PGID} user && \
adduser -D -u ${PUID} -G user user
# Install necessary packages for building Python packages
RUN apk add -u pipx musl-dev python3-dev gcc libffi-dev make openssl-dev python3 --no-cache
# Switch to the non-root user
USER user
# Install dissect with pipx
RUN pipx install dissect --include-deps
# Inject yara-python into dissect
RUN pipx inject dissect yara-python
# Set the working directory
WORKDIR /data
# Start the final stage
FROM alpine as final
# Set Python environment variables
ENV PYTHONDONTWRITEBYTECODE=1
# Add pip configuration (assuming you have a custom pip.conf)
ADD pip.conf /etc/pip.conf
# Set user ID and group ID arguments
ARG PUID=1001
ARG PGID=1001
# Create a user and group
RUN addgroup -g ${PGID} user && \
adduser -D -u ${PUID} -G user user
# Install pipx and Python (required for pipx to run)
RUN apk add -u pipx python3 bash --no-cache
# Switch to the non-root user
USER user
# Ensure pipx binaries are in the PATH
RUN pipx ensurepath
# Copy the installed packages from the builder stage
COPY --from=builder /home/user/.local /home/user/.local
# Set the working directory
WORKDIR /data
# Set the default command
CMD ["/bin/bash"]