Dockerfile36 lines · 1121 chars FROM debian:bookworm-slim AS builder
ENV DEBIAN_FRONTEND=noninteractive
WORKDIR /workspace
COPY . .
RUN apt-get update && \
apt-get install -y --no-install-recommends \
openjdk-17-jdk \
python3 \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Compile Java sources if present
RUN mkdir -p /workspace/build/classes
RUN bash -lc 'set -e; javac -version 2>&1 >/dev/null || true; if command -v javac >/dev/null 2>&1; then find . -name "*.java" -print0 | xargs -0 javac -d /workspace/build/classes 2>/dev/null || true; fi'
# Package any compiled classes into a jar for inspection
RUN mkdir -p /workspace/target
RUN bash -lc 'if [ -d /workspace/build/classes ]; then jar cf /workspace/target/webshell.jar -C /workspace/build/classes .; fi' || true
FROM debian:bookworm-slim
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends python3 ca-certificates && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=builder /workspace/target /app/target
EXPOSE 8080
CMD ["python3", "-m", "http.server", "8080", "--bind", "0.0.0.0"]