-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
44 lines (37 loc) · 1.36 KB
/
Copy pathDockerfile
File metadata and controls
44 lines (37 loc) · 1.36 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
ARG branch=stable
FROM cccs/assemblyline-v4-service-base:$branch
# Python path to the service class: <package>.<module>.<Class>
ENV SERVICE_PATH=pdfstudio_.pdfstudio_.PdfStudio
# Install apt dependencies (git is required to pip-install pdfstudio from source)
USER root
COPY pkglist.txt /tmp/setup/
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
$(grep -vE "^\s*(#|$)" /tmp/setup/pkglist.txt | tr "\n" " ") && \
rm -rf /tmp/setup/pkglist.txt /var/lib/apt/lists/*
# Install python dependencies (drop to the assemblyline user)
USER assemblyline
COPY requirements.txt requirements.txt
RUN pip install \
--no-cache-dir \
--user \
--requirement requirements.txt && \
rm -rf ~/.cache/pip
# Install pdfstudio itself. Override PDFSTUDIO_REF with a commit SHA at build
# time for a reproducible, pinned build:
# docker build --build-arg PDFSTUDIO_REF=<sha> ...
ARG PDFSTUDIO_REF=main
RUN pip install \
--no-cache-dir \
--user \
"pdfstudio[yara] @ git+https://github.com/boredchilada/pdfstudio.git@${PDFSTUDIO_REF}" && \
rm -rf ~/.cache/pip
# Copy the service code
WORKDIR /opt/al_service
COPY . .
# Ensure the service code is owned by the unprivileged runtime user
USER root
RUN chown -R assemblyline:assemblyline /opt/al_service
# Drop back to the unprivileged user for execution
USER assemblyline