mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Revert my last commit correctly
Man these are so getting squashed
This commit is contained in:
parent
b5f6e3587f
commit
53b2b2ed4b
23
Dockerfile
23
Dockerfile
@ -7,9 +7,11 @@ LABEL maintainer="Dockerfile created by Zedifus <https://gitlab.com/zedifus>"
|
|||||||
# Security Patch for CVE-2021-44228
|
# Security Patch for CVE-2021-44228
|
||||||
ENV LOG4J_FORMAT_MSG_NO_LOOKUPS=true
|
ENV LOG4J_FORMAT_MSG_NO_LOOKUPS=true
|
||||||
|
|
||||||
# Install Packages and Setup Dependencies in venv
|
# Install Packages, Dependencies and Setup user
|
||||||
COPY requirements.txt /commander-venv/requirements.txt
|
COPY requirements.txt /commander-venv/requirements.txt
|
||||||
RUN apt-get update \
|
RUN groupadd -g "${PGID:-0}" -o crafty \
|
||||||
|
&& useradd -g "${PGID:-0}" -u "${PUID:-0}" -o crafty \
|
||||||
|
&& apt-get update \
|
||||||
&& apt-get -y --no-install-recommends install \
|
&& apt-get -y --no-install-recommends install \
|
||||||
gcc \
|
gcc \
|
||||||
python3 \
|
python3 \
|
||||||
@ -28,20 +30,16 @@ RUN apt-get update \
|
|||||||
&& . /commander-venv/bin/activate \
|
&& . /commander-venv/bin/activate \
|
||||||
&& pip3 install --no-cache-dir --upgrade setuptools==50.3.2 pip==22.0.3 \
|
&& pip3 install --no-cache-dir --upgrade setuptools==50.3.2 pip==22.0.3 \
|
||||||
&& pip3 install --no-cache-dir -r /commander-venv/requirements.txt \
|
&& pip3 install --no-cache-dir -r /commander-venv/requirements.txt \
|
||||||
&& deactivate
|
&& deactivate \
|
||||||
|
&& chown -R crafty:crafty /commander-venv
|
||||||
|
|
||||||
# Copy Source and prepare config if needed, Then apply permissions.
|
# Copy Source & copy default config from image
|
||||||
COPY ./ /commander
|
COPY ./ /commander
|
||||||
WORKDIR /commander
|
WORKDIR /commander
|
||||||
RUN mv ./app/config ./app/config_original \
|
RUN mv ./app/config ./app/config_original \
|
||||||
&& mv ./app/config_original/default.json.example ./app/config_original/default.json \
|
&& mv ./app/config_original/default.json.example ./app/config_original/default.json \
|
||||||
&& chown -R 1001:0 /commander /commander-venv \
|
&& chown -R crafty:crafty /commander \
|
||||||
&& chmod -R g=u /commander /commander-venv \
|
&& chmod +x ./docker_launcher.sh
|
||||||
&& chmod +x ./docker_launcher.sh \
|
|
||||||
&& chmod 775 /commander /commander-venv
|
|
||||||
|
|
||||||
# Switch user to non-root
|
|
||||||
USER 1001
|
|
||||||
|
|
||||||
# Expose Web Interface port & Server port range
|
# Expose Web Interface port & Server port range
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
@ -49,6 +47,7 @@ EXPOSE 8443
|
|||||||
EXPOSE 19132
|
EXPOSE 19132
|
||||||
EXPOSE 25500-25600
|
EXPOSE 25500-25600
|
||||||
|
|
||||||
# Start Crafty Commander through wrapper
|
# Start Crafty Commander through wrapper as crafty
|
||||||
|
USER crafty
|
||||||
ENTRYPOINT ["/commander/docker_launcher.sh"]
|
ENTRYPOINT ["/commander/docker_launcher.sh"]
|
||||||
CMD ["-v", "-d", "-i"]
|
CMD ["-v", "-d", "-i"]
|
||||||
|
@ -5,6 +5,8 @@ services:
|
|||||||
container_name: crafty_commander
|
container_name: crafty_commander
|
||||||
image: registry.gitlab.com/crafty-controller/crafty-commander:latest
|
image: registry.gitlab.com/crafty-controller/crafty-commander:latest
|
||||||
environment:
|
environment:
|
||||||
|
- PGID=0
|
||||||
|
- PUID=0
|
||||||
- TZ=Etc/UTC
|
- TZ=Etc/UTC
|
||||||
ports:
|
ports:
|
||||||
- "8000:8000" # HTTP
|
- "8000:8000" # HTTP
|
||||||
|
@ -5,6 +5,8 @@ services:
|
|||||||
container_name: crafty_commander
|
container_name: crafty_commander
|
||||||
build: ..
|
build: ..
|
||||||
environment:
|
environment:
|
||||||
|
- PGID=0
|
||||||
|
- PUID=0
|
||||||
- TZ=Etc/UTC
|
- TZ=Etc/UTC
|
||||||
ports:
|
ports:
|
||||||
- "8000:8000" # HTTP
|
- "8000:8000" # HTTP
|
||||||
|
@ -6,6 +6,15 @@ if [ ! "$(ls -A ./app/config)" ]; then
|
|||||||
cp -r ./app/config_original/* ./app/config/
|
cp -r ./app/config_original/* ./app/config/
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Set user/group permissions to env or default to image root
|
||||||
|
groupmod -g "${PGID}" -o crafty
|
||||||
|
sed -i -E "s/^(crafty:x):[0-9]+:[0-9]+:(.*)/\\1:$PUID:$PGID:\\2/" /etc/passwd
|
||||||
|
|
||||||
|
# Apply new permissions taken from env over working dirs
|
||||||
|
chown -R crafty:crafty \
|
||||||
|
/commander/ \
|
||||||
|
/commander-venv/
|
||||||
|
|
||||||
# Activate our prepared venv and launch crafty with provided args
|
# Activate our prepared venv and launch crafty with provided args
|
||||||
. /commander-venv/bin/activate
|
. /commander-venv/bin/activate
|
||||||
exec python3 main.py $@
|
exec python3 main.py $@
|
||||||
|
Loading…
Reference in New Issue
Block a user