-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathDockerfile
More file actions
68 lines (55 loc) · 2.2 KB
/
Dockerfile
File metadata and controls
68 lines (55 loc) · 2.2 KB
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
# syntax=docker/dockerfile:1
FROM ubuntu:24.04
LABEL org.opencontainers.image.title="Exploration TeamServer"
LABEL org.opencontainers.image.description="Container image for the Exploration C2 TeamServer."
LABEL org.opencontainers.image.source="https://github.com/maxDcb/C2TeamServer"
ENV TEAMSERVER_HOME=/opt/teamserver
WORKDIR ${TEAMSERVER_HOME}
ARG C2TEAMSERVER_RELEASE_URL=""
# Install minimal dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
libstdc++6 \
wget \
jq \
tar \
&& rm -rf /var/lib/apt/lists/*
# Download and extract the latest Release from GitHub, or use an explicit URL.
RUN set -eux; \
if [ -n "${C2TEAMSERVER_RELEASE_URL}" ]; then \
release_url="${C2TEAMSERVER_RELEASE_URL}"; \
else \
release_url="$(wget -q -O - "https://api.github.com/repos/maxDcb/C2TeamServer/releases/latest" \
| jq -r '.assets[] | select(.name=="Release.tar.gz").browser_download_url')"; \
fi; \
wget -q "${release_url}" -O /tmp/Release.tar.gz; \
mkdir -p "${TEAMSERVER_HOME}/Release"; \
tar xf /tmp/Release.tar.gz --strip-components=1 -C "${TEAMSERVER_HOME}/Release"; \
rm /tmp/Release.tar.gz
# Add the entrypoint script directly
RUN cat > /usr/local/bin/teamserver-entrypoint.sh <<'EOF'
#!/bin/sh
set -e
RELEASE_DIR="/opt/teamserver/Release"
TEAMSERVER_DIR="${RELEASE_DIR}/TeamServer"
TEAMSERVER_BIN="${TEAMSERVER_DIR}/TeamServer"
if [ ! -x "${TEAMSERVER_BIN}" ]; then
cat >&2 <<'MSG'
[TeamServer] TeamServer binary was not found at /opt/teamserver/Release/TeamServer/TeamServer.
[TeamServer] The image normally ships with a bundled Release directory.
[TeamServer] If you want to override it, mount your own bundle on /opt/teamserver/Release.
MSG
exit 1
fi
mkdir -p "${TEAMSERVER_DIR}/logs"
cd "${TEAMSERVER_DIR}"
exec "${TEAMSERVER_BIN}" "$@"
EOF
# Make entrypoint executable + binary (if present)
RUN chmod +x /usr/local/bin/teamserver-entrypoint.sh \
&& if [ -f "${TEAMSERVER_HOME}/Release/TeamServer/TeamServer" ]; then \
chmod +x "${TEAMSERVER_HOME}/Release/TeamServer/TeamServer"; \
fi
EXPOSE 50051 80 443 8443
ENTRYPOINT ["/usr/local/bin/teamserver-entrypoint.sh"]