Skip to content

Commit

Permalink
Update Dockerfile, build hashr in a separate container
Browse files Browse the repository at this point in the history
  • Loading branch information
meeehow authored Aug 3, 2023
1 parent e7509d4 commit ea95e0f
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,36 +1,41 @@
# Use: docker build --no-cache --build-arg PPA_TRACK="[staging|stable]"

# Stage 0 - hashr-builder
FROM golang:alpine AS hashr-builder
RUN apk add --no-cache build-base

# Compile hashr statically
RUN mkdir -p /opt/hashr/
COPY . /opt/hashr/
RUN cd /opt/hashr/ && GOOS=linux GOARCH=amd64 go build -v -ldflags="-linkmode=external -extldflags=-static" -tags osusergo,netgo -o hashr hashr.go

# Stage 1 - hashr
FROM ubuntu:22.04

# Use: docker build --no-cache --build-arg PPA_TRACK="[staging|stable]"
ARG PPA_TRACK=stable

ENV DEBIAN_FRONTEND=noninteractive
#RUN apt-get update && apt-get -y upgrade
RUN apt-get update
RUN apt-get -y install \

RUN apt-get update && apt-get -y upgrade && apt-get -y install \
p7zip-full \
apt-transport-https \
apt-utils \
sudo \
curl \
file \
gpg \
software-properties-common

RUN rm -rf /var/lib/apt/lists/*
software-properties-common \
&& apt-get clean && rm -rf /var/cache/apt/* /var/lib/apt/lists/*

RUN curl -sS https://keyserver.ubuntu.com/pks/lookup?op=get\&search=0x3ed1eaece81894b171d7da5b5e80511b10c598b8 | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/gift.gpg
RUN add-apt-repository -y ppa:gift/$PPA_TRACK
RUN apt-get update && apt-get -y install \
plaso-tools \
--option Acquire::ForceIPv4=true --option Acquire::Retries=100 --option Acquire::http::Timeout=60
RUN apt-get update && apt-get -y install plaso-tools

RUN useradd -G disk,sudo -u 999 hashr
RUN echo "hashr ALL = (root) NOPASSWD: /bin/mount,/bin/umount,/sbin/losetup,/bin/rm" > /etc/sudoers.d/hashr

USER root

WORKDIR /usr/local/bin
COPY hashr .
COPY --from=hashr-builder /opt/hashr/hashr .

VOLUME ["/data"]

Expand Down

0 comments on commit ea95e0f

Please sign in to comment.