-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathDockerfile
46 lines (34 loc) · 1.36 KB
/
Dockerfile
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
45
46
ARG PYTHON_VERSION=3.11
FROM bitnami/python:${PYTHON_VERSION} AS base
ARG LOGPREP_VERSION=latest
# remove python-dev and upgrade packages
RUN apt-get update && apt-get purge -y python-dev && \
apt-get update && apt-get upgrade -y && apt-get clean && \
rm -rf /var/lib/apt/lists/*
FROM base AS prebuild
# Install the Rust toolchain
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
FROM prebuild AS build
ADD . /logprep
WORKDIR /logprep
# Use a python virtual environment
RUN python -m venv --upgrade-deps /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
RUN if [ "$LOGPREP_VERSION" = "dev" ]; then pip install . ;\
elif [ "$LOGPREP_VERSION" = "latest" ]; then pip install git+https://github.com/fkie-cad/Logprep.git@latest ; \
else pip install "logprep==$LOGPREP_VERSION" ; fi; \
/opt/venv/bin/logprep --version
# geoip2 4.8.0 lists a vulnerable setuptools version as a dependency. setuptools is unneeded at runtime, so it is uninstalled.
# More recent (currently unreleased) versions of geoip2 removed setuptools from dependencies.
RUN pip uninstall -y setuptools
FROM base AS prod
ARG http_proxy
ARG https_proxy
COPY --from=build /opt/venv /opt/venv
RUN useradd -s /bin/sh -m -c "logprep user" logprep
USER logprep
# Make sure we use the virtualenv:
ENV PATH="/opt/venv/bin:$PATH"
WORKDIR /home/logprep
ENTRYPOINT ["logprep"]