Initial Commit
This commit is contained in:
69
Dockerfile
Normal file
69
Dockerfile
Normal file
@@ -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"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user