From 9d48b5add4f61fcb1c0bd115038f277afe8c7036 Mon Sep 17 00:00:00 2001 From: tabledevil Date: Tue, 30 Jan 2024 09:55:31 +0100 Subject: [PATCH] Initial Commit --- Dockerfile | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ pip.conf | 5 ++++ 2 files changed, 74 insertions(+) create mode 100644 Dockerfile create mode 100644 pip.conf diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e737df1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,69 @@ +# 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"] + + diff --git a/pip.conf b/pip.conf new file mode 100644 index 0000000..b3f5298 --- /dev/null +++ b/pip.conf @@ -0,0 +1,5 @@ +[install] +compile = no + +[global] +no-cache-dir = True