Skip to content

Commit 53eab26

Browse files
committed
Merge branch 'dockerpatch' into develop
merging dockerpatch
2 parents 380ae8a + ecd927d commit 53eab26

File tree

3 files changed

+97
-13
lines changed

3 files changed

+97
-13
lines changed

build.sh

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Monkey365 - the PowerShell Cloud Security Tool for Azure and Microsoft 365 (copyright 2022) by Juan Garrido
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
18+
# Monkey365 – Docker Image Build and Tagging Script
19+
# Adapted from build.ps1 (PowerShell) to Bash
20+
# Author: Juan Garrido (original) (bash adaptation by goldrak)
21+
22+
23+
set -euo pipefail
24+
25+
NAME="monkey365"
26+
VERSION="latest"
27+
DOCKERFILE=""
28+
29+
usage() {
30+
cat <<EOF
31+
Use: $0 [Options]
32+
33+
Options:
34+
-n, --name Name of the Docker image (default: $NAME)
35+
-v, --version Image label (default: $VERSION)
36+
-p, --path Path to the Dockerfile (required)
37+
-h, --help Show this help and exit
38+
39+
Example:
40+
$0 -n monkey365 -v latest -p ./docker/Dockerfile_linux
41+
EOF
42+
exit 1
43+
}
44+
45+
while [[ $# -gt 0 ]]; do
46+
case "$1" in
47+
-n|--name)
48+
NAME="$2"; shift 2;;
49+
-v|--version)
50+
VERSION="$2"; shift 2;;
51+
-p|--path)
52+
DOCKERFILE="$2"; shift 2;;
53+
-h|--help)
54+
usage;;
55+
*)
56+
echo "Unknown option: $1"
57+
usage;;
58+
esac
59+
done
60+
61+
if [[ -z "$DOCKERFILE" ]]; then
62+
echo "Error: You must specify the path to the Dockerfile with -p or --path."
63+
usage
64+
fi
65+
66+
if [[ ! -f "$DOCKERFILE" ]]; then
67+
echo "Error: Dockerfile does not exist in '$DOCKERFILE'."
68+
exit 1
69+
fi
70+
71+
BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
72+
73+
TAG="${NAME}:${VERSION}"
74+
75+
echo "Building Dockerfile using file '${DOCKERFILE}' and tag '${TAG}'"
76+
77+
docker build \
78+
--rm \
79+
-f "$DOCKERFILE" \
80+
-t "$TAG" \
81+
--build-arg VERSION="$VERSION" \
82+
--build-arg VCS_URL="https://github.com/silverhack/monkey365" \
83+
--build-arg BUILD_DATE="$BUILD_DATE" \
84+
.
85+

docker/Dockerfile_linux

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
#bueno para mirar https://github.com/Stijnc/polaris-pshtml-docker
2-
FROM mcr.microsoft.com/powershell
1+
FROM mcr.microsoft.com/dotnet/sdk
32
#Labels
4-
LABEL version="1.0"
5-
LABEL description="Monkey365 container"
6-
LABEL author "Juan Garrido"
7-
LABEL email "[email protected]"
8-
LABEL twitter "https://twitter.com/tr1ana"
3+
LABEL version="1.0" \
4+
description="Monkey365 container" \
5+
author="Juan Garrido" \
6+
7+
twitter="https://twitter.com/tr1ana"
98
# Metadata parameters
109
ARG VERSION
1110
ARG VCS_URL

docker/Dockerfile_windows

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
FROM mcr.microsoft.com/powershell
1+
FROM mcr.microsoft.com/dotnet/sdk
22
#Labels
3-
LABEL version="1.0"
4-
LABEL description="Monkey365 container"
5-
LABEL author "Juan Garrido"
6-
LABEL email "[email protected]"
7-
LABEL twitter "https://twitter.com/tr1ana"
3+
LABEL version="1.0" \
4+
description="Monkey365 container" \
5+
author="Juan Garrido" \
6+
7+
twitter="https://twitter.com/tr1ana"
88
# Metadata parameters
99
ARG VERSION
1010
ARG VCS_URL

0 commit comments

Comments
 (0)