Skip to content

Commit ea95e0f

Browse files
authored
Update Dockerfile, build hashr in a separate container
1 parent e7509d4 commit ea95e0f

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

docker/Dockerfile

+18-13
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,41 @@
1+
# Use: docker build --no-cache --build-arg PPA_TRACK="[staging|stable]"
2+
3+
# Stage 0 - hashr-builder
4+
FROM golang:alpine AS hashr-builder
5+
RUN apk add --no-cache build-base
6+
7+
# Compile hashr statically
8+
RUN mkdir -p /opt/hashr/
9+
COPY . /opt/hashr/
10+
RUN cd /opt/hashr/ && GOOS=linux GOARCH=amd64 go build -v -ldflags="-linkmode=external -extldflags=-static" -tags osusergo,netgo -o hashr hashr.go
11+
12+
# Stage 1 - hashr
113
FROM ubuntu:22.04
214

3-
# Use: docker build --no-cache --build-arg PPA_TRACK="[staging|stable]"
415
ARG PPA_TRACK=stable
5-
616
ENV DEBIAN_FRONTEND=noninteractive
7-
#RUN apt-get update && apt-get -y upgrade
8-
RUN apt-get update
9-
RUN apt-get -y install \
17+
18+
RUN apt-get update && apt-get -y upgrade && apt-get -y install \
1019
p7zip-full \
1120
apt-transport-https \
1221
apt-utils \
1322
sudo \
1423
curl \
1524
file \
1625
gpg \
17-
software-properties-common
18-
19-
RUN rm -rf /var/lib/apt/lists/*
26+
software-properties-common \
27+
&& apt-get clean && rm -rf /var/cache/apt/* /var/lib/apt/lists/*
2028

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

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

3035
USER root
3136

3237
WORKDIR /usr/local/bin
33-
COPY hashr .
38+
COPY --from=hashr-builder /opt/hashr/hashr .
3439

3540
VOLUME ["/data"]
3641

0 commit comments

Comments
 (0)