Create Dockerfile and Wrapper

This commit is contained in:
Zedifus 2021-08-26 03:47:56 +01:00
parent f4ca0f6559
commit 2acc079e63
2 changed files with 39 additions and 0 deletions

31
Dockerfile Normal file
View File

@ -0,0 +1,31 @@
FROM python:alpine
LABEL maintainer="Dockerfile created by Zedifus <https://gitlab.com/zedifus>"
# Install Packages, Build Dependencies & Garbage Collect & Harden
# (Testing repo is needed because jre16 is new)
COPY requirements.txt /commander/requirements.txt
RUN apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing openssl-dev rust cargo gcc musl-dev libffi-dev make openjdk8-jre-base openjdk11-jre-headless openjdk16-jre-headless mariadb-dev \
&& pip3 install --no-cache-dir -r /commander/requirements.txt \
&& apk del --no-cache gcc musl-dev libffi-dev make rust cargo openssl-dev \
&& rm -rf /sbin/apk \
&& rm -rf /etc/apk \
&& rm -rf /lib/apk \
&& rm -rf /usr/share/apk \
&& rm -rf /var/lib/apk
# Copy Source & copy default config from image
COPY ./ /commander
WORKDIR /commander
RUN mv ./app/config ./app/config_original \
&& mv ./app/config_original/default.json.example ./app/config_original/default.json
# Expose Web Interface port & Server port range
EXPOSE 8000
EXPOSE 8443
EXPOSE 19132
EXPOSE 25500-25600
# Start Crafty Commander through wrapper
ENTRYPOINT ["/commander/docker_launcher.sh"]
CMD ["-v", "-d", "-i"]

8
docker_launcher.sh Normal file
View File

@ -0,0 +1,8 @@
#!/bin/sh
# Check if config exists from existing installation (venv or previous docker launch)
if [ ! "$(ls -A ./app/config)" ]; then
cp -r ./app/config_original/* ./app/config/
fi
exec python3 main.py $@