Skip to content

Commit

Permalink
Update docker files
Browse files Browse the repository at this point in the history
  • Loading branch information
jleaniz committed Nov 18, 2024
1 parent 66cc006 commit 40c776d
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 32 deletions.
15 changes: 8 additions & 7 deletions docker/api_server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,14 @@ COPY web/. .
RUN npm run build

# Build Turbinia API Server, copy from build, and setup rest of requirements
FROM --platform=linux/amd64 ubuntu:22.04 as build-stage2
FROM --platform=linux/amd64 ubuntu:24.04 as build-stage2

ENV DEBIAN_FRONTEND=noninteractive \
PIP_NO_CACHE_DIR=1

COPY --from=build-stage /tmp/web/dist /web/dist
RUN apt-get update && apt-get -y upgrade
RUN apt-get -y install git python3-pip
RUN pip3 install pip --upgrade
RUN pip3 install poetry
RUN apt-get -y install git python3-pip python3.12-venv

RUN useradd -r -s /sbin/nologin -u 999 turbinia
RUN mkdir /etc/turbinia && mkdir -p /mnt/turbinia/ && mkdir -p /var/lib/turbinia/ \
Expand All @@ -31,13 +29,16 @@ RUN mkdir /etc/turbinia && mkdir -p /mnt/turbinia/ && mkdir -p /var/lib/turbinia
USER turbinia
WORKDIR /home/turbinia

# Install poetry
RUN python3 -m venv .venv
ENV PATH="/home/turbinia/.local/bin:/home/turbinia/.venv/bin:$PATH" \
VIRTUAL_ENV=/home/turbinia/.venv
RUN curl -sSL https://install.python-poetry.org | python3 -

# Copy requirements and install dependencies to cache them in docker layer
COPY --chown=turbinia:turbinia ./pyproject.toml ./poetry.toml ./poetry.lock /home/turbinia/
RUN poetry install --no-interaction --no-ansi --no-root

ENV PATH="/home/turbinia/.venv/bin:$PATH" \
VIRTUAL_ENV=/home/turbinia/.venv

# Copy the source directory to the container
COPY --chown=turbinia:turbinia . /home/turbinia/
COPY --chown=turbinia:turbinia docker/api_server/start.sh /home/turbinia/start.sh
Expand Down
2 changes: 1 addition & 1 deletion docker/oauth2_proxy/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:20.04
FROM ubuntu:24.04

ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get -y upgrade
Expand Down
15 changes: 8 additions & 7 deletions docker/server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM --platform=linux/amd64 ubuntu:22.04
FROM --platform=linux/amd64 ubuntu:24.04

ENV DEBIAN_FRONTEND=noninteractive
ENV PIP_NO_CACHE_DIR=1
Expand All @@ -9,13 +9,11 @@ RUN apt-get update && apt-get -y upgrade && apt-get -y install \
git \
libterm-readline-gnu-perl \
python3-pip \
python3.12-venv \
software-properties-common \
sudo \
&& apt-get clean && rm -rf /var/cache/apt/* /var/lib/apt/lists/*

RUN pip3 install pip --upgrade
RUN pip3 install poetry

RUN useradd -r -s /sbin/nologin -u 999 turbinia

RUN mkdir /etc/turbinia && mkdir -p /mnt/turbinia/ && mkdir -p /var/lib/turbinia/ \
Expand All @@ -30,13 +28,16 @@ RUN mkdir /etc/turbinia && mkdir -p /mnt/turbinia/ && mkdir -p /var/lib/turbinia
USER turbinia
WORKDIR /home/turbinia

# Install poetry
RUN python3 -m venv .venv
ENV PATH="/home/turbinia/.local/bin:/home/turbinia/.venv/bin:$PATH" \
VIRTUAL_ENV=/home/turbinia/.venv
RUN curl -sSL https://install.python-poetry.org | python3 -

# Copy requirements and install dependencies to cache them in docker layer
COPY --chown=turbinia:turbinia ./pyproject.toml ./poetry.toml ./poetry.lock /home/turbinia/
RUN poetry install --no-interaction --no-ansi --no-root

ENV PATH="/home/turbinia/.venv/bin:$PATH" \
VIRTUAL_ENV=/home/turbinia/.venv

# Copy the source directory to the container
COPY --chown=turbinia:turbinia . /home/turbinia/
COPY --chown=turbinia:turbinia docker/server/start.sh /home/turbinia/start.sh
Expand Down
19 changes: 8 additions & 11 deletions docker/tests/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM --platform=linux/amd64 ubuntu:22.04
FROM --platform=linux/amd64 ubuntu:24.04
ENV DEBIAN_FRONTEND=noninteractive \
PIP_NO_CACHE_DIR=1
ARG PPA_TRACK=stable
Expand All @@ -22,19 +22,14 @@ RUN apt-get update && apt-get -y upgrade && apt-get -y install \
p7zip-full \
pkg-config \
python3-pip \
python3.10-venv \
python3.12-venv \
software-properties-common \
sudo \
testdisk \
tox \
wget \
&& apt-get clean && rm -rf /var/cache/apt/* /var/lib/apt/lists/*

# Install Poetry
RUN pip3 install pip --upgrade
RUN pip3 install poetry
RUN pip3 install -U packaging

# Install various packages from the GIFT PPA
# bulkextractor
# docker-explorer
Expand Down Expand Up @@ -103,14 +98,16 @@ WORKDIR /home/turbinia
# Copy only requirements, to cache them in docker layer
COPY --chown=turbinia:turbinia ./pyproject.toml ./poetry.toml ./poetry.lock /home/turbinia/

# Install poetry
RUN python3 -m venv .venv
ENV PATH="/home/turbinia/.local/bin:/home/turbinia/.venv/bin:$PATH" \
VIRTUAL_ENV=/home/turbinia/.venv
RUN curl -sSL https://install.python-poetry.org | python3 -

# Install dependencies using Poetry
RUN poetry install --no-interaction --no-ansi -E worker --with test --no-root
RUN poetry run python3 -m pip install impacket --no-deps

# Activate the virtualenv
ENV PATH="/home/turbinia/.venv/bin:$PATH" \
VIRTUAL_ENV=/home/turbinia/.venv

# Install Turbinia and dependencies in /home/turbinia/.venv using Poetry
ADD . /home/turbinia/
# RUN if $(cd /tmp/ && git rev-parse --is-shallow-repository); then cd /tmp/ && git fetch --prune --unshallow && git fetch --depth=1 origin +refs/tags/*:refs/tags/*; fi
Expand Down
14 changes: 8 additions & 6 deletions docker/worker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build 1 - Turbinia Worker
FROM --platform=linux/amd64 ubuntu:22.04
FROM --platform=linux/amd64 ubuntu:24.04
ENV DEBIAN_FRONTEND=noninteractive \
PIP_NO_CACHE_DIR=1
ARG PPA_TRACK=stable
Expand All @@ -20,15 +20,13 @@ RUN apt-get update && apt-get -y upgrade && apt-get -y install \
pocl-opencl-icd \
p7zip-full \
python3-pip \
python3.12-venv \
software-properties-common \
sudo \
testdisk \
wget \
&& apt-get clean && rm -rf /var/cache/apt/* /var/lib/apt/lists/*

RUN pip3 install pip --upgrade
RUN pip3 install poetry

# Install various packages from the GIFT PPA
# bulkextractor
# docker-explorer
Expand Down Expand Up @@ -104,12 +102,16 @@ COPY --chown=turbinia:turbinia k8s/tools/check-lockfile.py /home/turbinia/check-
USER turbinia
WORKDIR /home/turbinia

# Install poetry
RUN python3 -m venv .venv
ENV PATH="/home/turbinia/.local/bin:/home/turbinia/.venv/bin:$PATH" \
VIRTUAL_ENV=/home/turbinia/.venv
RUN curl -sSL https://install.python-poetry.org | python3 -

# Copy requirements and install dependencies to cache them in docker layer
COPY --chown=turbinia:turbinia ./pyproject.toml ./poetry.toml ./poetry.lock /home/turbinia/
RUN poetry install --no-interaction --no-ansi -E worker --no-root
RUN poetry run pip3 install impacket --no-deps
ENV PATH="/home/turbinia/.venv/bin:$PATH" \
VIRTUAL_ENV=/home/turbinia/.venv

# Copy the source directory to the container
COPY --chown=turbinia:turbinia . /home/turbinia/
Expand Down

0 comments on commit 40c776d

Please sign in to comment.