mirror of
https://github.com/telekom-security/tpotce.git
synced 2025-04-19 21:52:27 +00:00
Optimize image, pyinstaller
This commit is contained in:
parent
967ddf6d2f
commit
2c639a2dd8
1 changed files with 23 additions and 23 deletions
|
@ -1,10 +1,11 @@
|
||||||
FROM alpine:3.19
|
FROM alpine:3.20 AS builder
|
||||||
#
|
#
|
||||||
# Include dist
|
# Include dist
|
||||||
COPY dist/ /root/dist/
|
COPY dist/ /root/dist/
|
||||||
#
|
#
|
||||||
# Install packages
|
# Install packages
|
||||||
RUN apk --no-cache -U add \
|
RUN apk --no-cache -U upgrade && \
|
||||||
|
apk --no-cache -U add \
|
||||||
build-base \
|
build-base \
|
||||||
git \
|
git \
|
||||||
libcap \
|
libcap \
|
||||||
|
@ -18,33 +19,32 @@ RUN apk --no-cache -U add \
|
||||||
py3-werkzeug \
|
py3-werkzeug \
|
||||||
py3-yaml \
|
py3-yaml \
|
||||||
python3 \
|
python3 \
|
||||||
python3-dev && \
|
python3-dev
|
||||||
#
|
#
|
||||||
# Install wordpot from GitHub and setup
|
# Install wordpot from GitHub and setup
|
||||||
mkdir -p /opt && \
|
RUN mkdir -p /opt && \
|
||||||
cd /opt/ && \
|
cd /opt/ && \
|
||||||
git clone https://github.com/t3chn0m4g3/wordpot && \
|
git clone https://github.com/t3chn0m4g3/wordpot && \
|
||||||
cd wordpot && \
|
cd wordpot && \
|
||||||
git checkout 8fedeb1b74e1d225da2a7273656bf0afa84a20aa && \
|
git checkout b2701cb6c7057ed2843187c0c425bb8c13845719 && \
|
||||||
cp /root/dist/requirements.txt . && \
|
cp /root/dist/requirements.txt .
|
||||||
pip3 install --break-system-packages -r requirements.txt && \
|
WORKDIR /opt/wordpot
|
||||||
setcap cap_net_bind_service=+ep $(readlink -f $(type -P python3)) && \
|
RUN pip3 install --no-cache-dir --break-system-packages pyinstaller
|
||||||
|
RUN pip3 install --no-cache-dir --break-system-packages -r requirements.txt
|
||||||
|
RUN pyinstaller wordpot.py \
|
||||||
|
--hidden-import hpfeeds \
|
||||||
|
--add-data "./wordpot/static:./wordpot/static" \
|
||||||
|
--add-data "./wordpot/templates:./wordpot/templates" \
|
||||||
|
--add-data "./wordpot/plugins:./wordpot/plugins" \
|
||||||
|
--add-data "./wordpot.conf:./"
|
||||||
|
RUN ls -alR
|
||||||
#
|
#
|
||||||
# Setup user, groups and configs
|
FROM alpine:3.20
|
||||||
addgroup -g 2000 wordpot && \
|
RUN apk --no-cache -U upgrade
|
||||||
adduser -S -H -s /bin/ash -u 2000 -D -g 2000 wordpot && \
|
COPY --from=builder /opt/wordpot/dist /opt/
|
||||||
chown wordpot:wordpot -R /opt/wordpot && \
|
|
||||||
#
|
|
||||||
# Clean up
|
|
||||||
apk del --purge build-base \
|
|
||||||
git \
|
|
||||||
python3-dev && \
|
|
||||||
rm -rf /root/* \
|
|
||||||
/var/cache/apk/* \
|
|
||||||
/opt/wordpot/.git
|
|
||||||
#
|
#
|
||||||
# Start wordpot
|
# Start wordpot
|
||||||
STOPSIGNAL SIGINT
|
STOPSIGNAL SIGINT
|
||||||
USER wordpot:wordpot
|
USER 2000:2000
|
||||||
WORKDIR /opt/wordpot
|
WORKDIR /opt/wordpot/
|
||||||
CMD ["/usr/bin/python3","wordpot.py", "--host", "0.0.0.0", "--port", "80", "--title", "Wordpress"]
|
CMD ["./wordpot", "--host", "0.0.0.0", "--port", "80", "--title", "Wordpress"]
|
||||||
|
|
Loading…
Reference in a new issue