FROM ubuntu:20.04 ARG SALT_USER ARG SALT_PASS RUN adduser --no-create-home --disabled-password --gecos "" ${SALT_USER} && \ echo "${SALT_USER}:${SALT_PASS}" | chpasswd && \ apt-get update && \ apt-get install -y ca-certificates wget gnupg2 gettext-base tzdata supervisor && \ wget -O - https://repo.saltstack.com/py3/ubuntu/20.04/amd64/latest/SALTSTACK-GPG-KEY.pub | apt-key add - && \ echo 'deb http://repo.saltstack.com/py3/ubuntu/20.04/amd64/latest focal main' | tee /etc/apt/sources.list.d/saltstack.list && \ apt-get update && \ apt-get install -y salt-master salt-api && \ mkdir -p /var/log/supervisor COPY ./docker/salt/api.conf /etc/salt/master.d/rmm-salt.tmp RUN envsubst '\$SALT_USER' < /etc/salt/master.d/rmm-salt.tmp | tee /etc/salt/master.d/rmm-salt.conf && \ rm /etc/salt/master.d/rmm-salt.tmp RUN sed -i 's/msgpack_kwargs = {"raw": six.PY2}/msgpack_kwargs = {"raw": six.PY2, "max_buffer_size": 2147483647}/g' /usr/lib/python3/dist-packages/salt/transport/ipc.py COPY ./docker/salt/supervisor.conf /etc/supervisor/conf.d/supervisor.conf COPY ./_modules /srv/salt/_modules COPY ./scripts /srv/salt/scripts RUN mkdir -p /srv/salt/scripts/userdefined && \ chown -R 1000:102 /srv/salt/scripts/userdefined && \ chmod -R 771 /srv/salt/scripts/userdefined EXPOSE 8123 4505 4506 CMD ["/usr/bin/supervisord"]