-
Notifications
You must be signed in to change notification settings - Fork 761
/
Dockerfile
92 lines (78 loc) · 2.74 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# A Docker image capable of running all GRR components.
#
# See https://github.com/google/grr/pkgs/container/grr
#
# We have configured Github Actions to trigger an image build every
# time a new a PUSH happens in the GRR github repository.
#
# Examples:
# - Run a grr server component (e.g. admin_ui):
#
# $ docker run -it \
# -v $(pwd)/docker_config_files/server:/configs \
# ghcr.io/google/grr:latest \
# "-component" "admin_ui" \
# "-config" "/configs/grr.server.yaml"
#
# - Run the grr client component:
# -- Start the container and mount the client config directory:
# $ docker run -it \
# -v $(pwd)/docker_config_files/client:/configs \
# --entrypoint /bin/bash \
# ghcr.io/google/grr:latest
#
# -- The previous command will leave you with an open shell in
# the container. Repack the client template and install the
# resulting debian file inside the container:
# root@<CONTAINER ID> $ /configs/repack_install_client.sh
#
# -- Start fleetspeak and grr clients:
# root@<CONTAINER ID> $ fleetspeak-client -config /configs/client.config
#
# -- (Optional) To verify if the client runs, check if the two expected
# processes are running:
# root@<CONTAINER ID> $ ps aux
# ... COMMAND
# ... fleetspeak-client -config /configs/client.config
# ... python -m grr_response_client.client ...
FROM ubuntu:22.04
LABEL maintainer="[email protected]"
ENV DEBIAN_FRONTEND=noninteractive
# Buffering output (sometimes indefinitely if a thread is stuck in
# a loop) makes for a non-optimal user experience when containers
# are run in the foreground, so we disable that.
ENV PYTHONUNBUFFERED=0
RUN apt-get update && \
apt-get install -y \
default-jre \
python-is-python3 \
python3-dev \
python3-pip \
python3-venv \
python3-mysqldb \
build-essential \
linux-headers-generic \
dh-make \
rpm
# Copy the client installers to the image, only available when
# building as part of Github Actions.
COPY ./_installers* /client_templates
ENV VIRTUAL_ENV=/usr/share/grr-server
ENV GRR_SOURCE=/usr/src/grr
RUN python -m venv --system-site-packages $VIRTUAL_ENV
ENV PATH=${VIRTUAL_ENV}/bin:${PATH}
RUN ${VIRTUAL_ENV}/bin/python -m pip install wheel nodeenv grpcio-tools==1.60
RUN ${VIRTUAL_ENV}/bin/nodeenv -p --prebuilt --node=16.13.0
RUN mkdir -p ${GRR_SOURCE}
ADD . ${GRR_SOURCE}
WORKDIR ${GRR_SOURCE}
RUN ${VIRTUAL_ENV}/bin/python -m pip install \
-e grr/proto \
-e grr/core \
-e grr/client \
-e grr/server \
-e grr/client_builder \
-e api_client/python
RUN ${VIRTUAL_ENV}/bin/python grr/proto/makefile.py && \
${VIRTUAL_ENV}/bin/python grr/core/grr_response_core/artifacts/makefile.py
ENTRYPOINT [ "grr_server" ]