This repository has been archived by the owner on May 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile.testing
108 lines (96 loc) · 4.84 KB
/
Dockerfile.testing
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
## DIGEST f0a9bdbceb34c8a3f4bf5455998c5f562e53e6d1f764bbdd2ac519a8c3ef2559
## docker.io/golang:alpine3.14
FROM docker.io/golang@sha256:f0a9bdbceb34c8a3f4bf5455998c5f562e53e6d1f764bbdd2ac519a8c3ef2559 AS build-env
LABEL org.opencontainers.image.authors="github.com/arainho"
ENV MY_USER="appuser"
ENV MY_GROUP="appgroup"
ENV MY_HOME="/home/$MY_USER"
ENV GOPATH="$MY_HOME/go"
ENV APPS_TARGET="$MY_HOME/apps"
ENV PATH="$MY_HOME/bin:$MY_HOME/go/bin:$MY_HOME/.local/bin:$HOME/node_modules/.bin:$HOME/.rbenv/bin:$PATH:$MY_HOME/.cargo/bin:$MY_HOME/.apicheck_manager/bin:$PATH"
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# general
RUN addgroup -g 9999 $MY_GROUP && \
adduser -u 9999 -D -G $MY_GROUP -h $MY_HOME $MY_USER && \
apk update && \
apk add --no-cache sudo && \
adduser $MY_USER wheel && \
echo "$MY_USER ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/$MY_USER && \
chmod 0440 /etc/sudoers.d/$MY_USER && \
apk add --no-cache bash zsh fish \
bind-tools openssh git strace gdb \
mandoc man-pages less less-doc jq \
netcat-openbsd curl wget httpie nmap \
ca-certificates coreutils libzip-dev zip unzip && \
apk add --no-cache --update python2 python3 py3-pip && \
python2 -m ensurepip && \
unlink /usr/bin/pip && \
unlink /usr/bin/python && \
ln -s /usr/bin/pip3 /usr/bin/pip && \
ln -s /usr/bin/python3 /usr/bin/python && \
python2 -m pip install --upgrade pip setuptools && \
python3 -m pip install --upgrade pip setuptools && \
apk add --no-cache --update nodejs npm && \
apk add --no-cache --update libffi-dev python3-dev && \
apk add --no-cache --update wireshark xxd protoc && \
apk add --no-cache --update perl && \
apk add --no-cache --update ruby ruby-dev && \
apk add --no-cache --update openssl openssl-dev openssl-libs-static && \
apk add --no-cache --update alpine-sdk clang gcc make build-base cmake && \
apk add --no-cache --update bsd-compat-headers linux-headers && \
apk add --no-cache --update zlib-dev libevent libevent-dev && \
apk add --no-cache --update openjdk8-jre gradle && \
apk add --no-cache --update bash icu-libs krb5-libs libgcc libintl libssl1.1 libstdc++ zlib && \
apk add --no-cache ragel boost-dev pkgconfig libpcap-dev && \
apk add --no-cache libgdiplus --repository https://dl-3.alpinelinux.org/alpine/edge/testing && \
adduser $MY_USER wireshark
### TESTING tools installation that need root privileges
# ENV TOOL_NAME="tool-name"
# RUN <add installation commands here>
ENV TOOL_NAME="etckeeper"
RUN apk add --no-cache --update etckeeper && \
sed -i -- 's/VCS=.*/VCS\="git"/g' /etc/etckeeper/etckeeper.conf && \
git config --global init.defaultBranch master && \
git config --global user.email "me@apisec-toolbox.local" && \
git config --global user.name "Me Myself and I" && \
cd /etc/ && \
etckeeper init && \
etckeeper commit "initial commit of /etc directory"
USER $MY_USER
WORKDIR $MY_HOME
# create folders
RUN mkdir -m 750 -p $APPS_TARGET && \
mkdir -m 750 -p $MY_HOME/bin && \
mkdir -m 750 -p $MY_HOME/plugins && \
mkdir -m 750 -p $MY_HOME/wordlists && \
mkdir -m 750 -p $MY_HOME/extensions && \
mkdir -m 750 -p $MY_HOME/templates && \
mkdir -m 750 -p $MY_HOME/signatures && \
mkdir -m 750 -p $MY_HOME/share/man/man1
# virtual envs, pkg's and versions managers
RUN python3 -m pip install --upgrade pipenv && \
python3 -m pip install --user virtualenv && \
python2 -m pip install --user virtualenv && \
git clone https://github.com/rbenv/rbenv.git ~/.rbenv && \
export PATH="$(ruby -r rubygems -e 'puts Gem.user_dir')/bin:$PATH" && \
echo 'if which ruby >/dev/null && which gem >/dev/null; then PATH="$(ruby -r rubygems -e 'puts Gem.user_dir')/bin:$PATH"; fi' >> ~/.bashrc && \
npm install yarn && \
export PATH="$PATH:$($HOME/node_modules/.bin/yarn global bin)" && \
echo 'if which yarn >/dev/null; then echo export PATH="$PATH:$($HOME/node_modules/.bin/yarn global bin)"; fi' >> ~/.bashrc && \
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \
source $MY_HOME/.cargo/env && \
rustup component add rustfmt && \
rustup component add clippy
#######################################################
# STEPS FOR TESTING #
# 1. change 'tool-name' and 'installation commands'; #
# 2. remove the symbols < and > #
# 3. uncomment ENV and RUN lines #
# 4. build the image #
#######################################################
# WARNING: If you need root privileges to install tools, move the two lines below before entry USER="$MY_USER" !
#
# ENV TOOL_NAME="tool-name"
# RUN <add installation commands here>
CMD ["/bin/bash"]