You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
279 lines
8.5 KiB
279 lines
8.5 KiB
###########################################################################
|
|
# Set custom timezone if needed
|
|
###########################################################################
|
|
|
|
ARG CUSTOM_TZ=Etc/UTC
|
|
|
|
RUN if [ ${CUSTOM_TZ} -ne $(cat /etc/timezone) ]; then \
|
|
ln -snf /usr/share/zoneinfo/$CUSTOM_TZ /etc/localtime && \
|
|
echo $CUSTOM_TZ > /etc/timezone \
|
|
;fi
|
|
|
|
###########################################################################
|
|
# Set additional locale if needed:
|
|
###########################################################################
|
|
|
|
ARG CUSTOM_LOCALE=en_US.UTF-8
|
|
|
|
RUN if [ ${CUSTOM_LOCALE} -ne 'en_US.UTF-8' ]; then \
|
|
locale-gen ${CUSTOM_LOCALE} \
|
|
;fi
|
|
|
|
###########################################################################
|
|
# Laradock non-root user:
|
|
###########################################################################
|
|
|
|
ARG CUSTOM_PUID=1000
|
|
ARG CUSTOM_PGID=1000
|
|
|
|
RUN if [ ${CUSTOM_PUID} -nq 1000 ]; then \
|
|
usermod -u ${CUSTOM_PUID} laradock \
|
|
;fi
|
|
|
|
RUN if [ ${CUSTOM_PGID} -nq 1000 ]; then \
|
|
groupmod -g ${CUSTOM_PGID} laradock \
|
|
chown -R :${CUSTOM_PGID} /home/laradock \
|
|
;fi
|
|
|
|
###########################################################################
|
|
# Update composer version if needed
|
|
###########################################################################
|
|
|
|
USER root
|
|
|
|
ARG COMPOSER_VERSION=2
|
|
RUN set -e; if [ ${COMPOSER_VERSION} -ne 2 ]; then \
|
|
composer self-update --${COMPOSER_VERSION}; \
|
|
mkdir -p ${HOME}/.composer; \
|
|
ln -s /run/secrets/composer_auth ${HOME}/.composer/auth.json; \
|
|
else \
|
|
mkdir -p ${HOME}/.config/composer; \
|
|
ln -s /run/secrets/composer_auth ${HOME}/.config/composer/auth.json; \
|
|
fi
|
|
|
|
###########################################################################
|
|
# WP CLI:
|
|
###########################################################################
|
|
|
|
# The command line interface for WordPress
|
|
|
|
USER root
|
|
|
|
ARG INSTALL_WP_CLI=false
|
|
|
|
RUN if [ ${INSTALL_WP_CLI} = true ]; then \
|
|
curl -fsSL -o /usr/local/bin/wp https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar | bash && \
|
|
chmod +x /usr/local/bin/wp \
|
|
;fi
|
|
|
|
###########################################################################
|
|
# Pear Mail and Mail_Mime:
|
|
###########################################################################
|
|
|
|
ARG INSTALL_PEAR_MAIL=false
|
|
|
|
RUN if [ ${INSTALL_PEAR_MAIL} = true ]; then \
|
|
pear install Mail && pear install Mail_Mime \
|
|
;fi
|
|
|
|
###########################################################################
|
|
# Node / NVM:
|
|
###########################################################################
|
|
|
|
ARG INSTALL_NODE=false
|
|
|
|
ARG NODE_VERSION=v18.18.0
|
|
ENV NODE_VERSION ${NODE_VERSION}
|
|
|
|
USER laradock
|
|
|
|
ENV NVM_DIR /home/laradock/.nvm
|
|
|
|
RUN if [ ${INSTALL_NODE} = true ]; then \
|
|
mkdir -p $NVM_DIR && \
|
|
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash \
|
|
&& . $NVM_DIR/nvm.sh \
|
|
;fi
|
|
|
|
# Wouldn't execute when added to the RUN statement in the above block
|
|
# Source NVM when loading bash since ~/.profile isn't loaded on non-login shell
|
|
RUN if [ ${INSTALL_NODE} = true ]; then \
|
|
echo "" >> ~/.bashrc && \
|
|
echo 'export NVM_DIR="$HOME/.nvm"' >> ~/.bashrc && \
|
|
echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm' >> ~/.bashrc \
|
|
;fi
|
|
|
|
# Add NVM binaries to root's .bashrc
|
|
USER root
|
|
|
|
RUN if [ ${INSTALL_NODE} = true ]; then \
|
|
cp -R /home/laradock/.nvm /root/ && \
|
|
chown -R root:root /root/.nvm && \
|
|
echo "" >> ~/.bashrc && \
|
|
echo 'export NVM_DIR="$HOME/.nvm"' >> ~/.bashrc && \
|
|
echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm' >> ~/.bashrc \
|
|
;fi
|
|
|
|
USER root
|
|
|
|
RUN if [ ${INSTALL_NODE} = true ]; then \
|
|
. ~/.bashrc && nvm install ${NODE_VERSION} \
|
|
&& . ~/.bashrc && nvm alias default ${NODE_VERSION} \
|
|
&& npm i -g yarn \
|
|
&& cp -R ~/.nvm/alias /home/laradock/.nvm \
|
|
&& cp -R ~/.nvm/versions /home/laradock/.nvm \
|
|
&& chown -R ${CUSTOM_PUID}:${CUSTOM_PGID} /home/laradock/.nvm \
|
|
;fi
|
|
|
|
###########################################################################
|
|
# APT
|
|
###########################################################################
|
|
|
|
# once please
|
|
RUN apt update -qq
|
|
|
|
###########################################################################
|
|
# YADM
|
|
###########################################################################
|
|
|
|
ARG INSTALL_YADM=true
|
|
|
|
USER root
|
|
|
|
RUN if [ ${INSTALL_YADM} = true ]; then \
|
|
apt-get install direnv yadm tmux -qq && \
|
|
curl -sS https://starship.rs/install.sh | sh -s -- -f && \
|
|
yadm clone --bootstrap https://vcs.wpstudio.ru/gitea/dotfiles.git \
|
|
;fi
|
|
|
|
USER laradock
|
|
|
|
RUN if [ ${INSTALL_YADM} = true ]; then \
|
|
yadm clone --bootstrap https://vcs.wpstudio.ru/gitea/dotfiles.git && \
|
|
sed -i 's/#/\\$/g' ${HOME}/.config/starship.toml \
|
|
;fi
|
|
|
|
###########################################################################
|
|
# FINE UTILS:
|
|
###########################################################################
|
|
|
|
USER root
|
|
|
|
RUN if [ ${INSTALL_FINE_UTILS} = true ]; then \
|
|
apt-get install htop -qq \
|
|
;fi
|
|
|
|
###########################################################################
|
|
# SUPERVISOR:
|
|
###########################################################################
|
|
|
|
USER root
|
|
|
|
ARG INSTALL_SUPERVISOR=false
|
|
|
|
RUN if [ ${INSTALL_SUPERVISOR} = true ]; then \
|
|
apt-get install supervisor -qq \
|
|
;fi
|
|
|
|
###########################################################################
|
|
# PYTHON & UVICORN:
|
|
###########################################################################
|
|
|
|
USER root
|
|
|
|
ARG INSTALL_PYTHON=false
|
|
|
|
RUN if [ ${INSTALL_PYTHON} = true ]; then \
|
|
apt-get install liblzma-dev libbz2-dev libffi-dev libreadline-dev zlib1g-dev -qq --no-install-recommends \
|
|
;fi
|
|
|
|
USER laradock
|
|
|
|
SHELL ["/bin/bash", "-c"]
|
|
|
|
ARG PYTHON_VERSION=3.12
|
|
ENV PYENV_VERSION=${PYTHON_VERSION}
|
|
|
|
RUN if [ ${INSTALL_PYTHON} = true ]; then \
|
|
set -e; \
|
|
curl https://pyenv.run | bash &&\
|
|
echo '' >> ~/.shell-env.local && \
|
|
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.shell-env.local && \
|
|
echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.shell-env.local && \
|
|
echo 'eval "$(pyenv init -)"' >> ~/.shell-env.local && \
|
|
echo '' >> ~/.shell-env.local && \
|
|
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.shell-env.local && \
|
|
echo '' >> ~/.shell-env.local && \
|
|
$HOME/.pyenv/bin/pyenv install ${PYTHON_VERSION} \
|
|
;fi
|
|
|
|
RUN if [ ${INSTALL_PYTHON} = true ]; then \
|
|
bash -ic 'python -m pip install uvicorn' \
|
|
;fi
|
|
|
|
RUN if [ false = true ]; then \
|
|
python -m pip install uvicorn && \
|
|
python -m pip install --upgrade supervisor && \
|
|
echo_supervisord_conf > /etc/supervisord.conf && \
|
|
sed -i 's/\;\[include\]/\[include\]/g' /etc/supervisord.conf && \
|
|
sed -i 's/\;files\s.*/files = supervisord.d\/*.conf/g' /etc/supervisord.conf \
|
|
;fi
|
|
|
|
SHELL ["/bin/sh", "-c"]
|
|
|
|
###########################################################################
|
|
# Libreoffice
|
|
###########################################################################
|
|
|
|
USER root
|
|
|
|
ARG INSTALL_LIBREOFFICE=false
|
|
|
|
RUN if [ ${INSTALL_LIBREOFFICE} = true ]; then \
|
|
add-apt-repository -y ppa:libreoffice/ppa \
|
|
&& apt update -qq \
|
|
&& apt-get install libreoffice-nogui -qq --no-install-recommends \
|
|
;fi
|
|
|
|
###########################################################################
|
|
# НУЦ:
|
|
###########################################################################
|
|
|
|
USER root
|
|
|
|
ARG INSTALL_NUC_CERTS=false
|
|
|
|
RUN if [ ${INSTALL_NUC_CERTS} = true ]; then \
|
|
mkdir /usr/local/share/ca-certificates/extra && \
|
|
cd /usr/local/share/ca-certificates/extra && \
|
|
curl -O https://gu-st.ru/content/lending/russian_trusted_root_ca_pem.crt && \
|
|
curl -O https://gu-st.ru/content/lending/russian_trusted_sub_ca_pem.crt && \
|
|
update-ca-certificates \
|
|
;fi
|
|
|
|
###########################################################################
|
|
# Tune opts:
|
|
###########################################################################
|
|
|
|
USER root
|
|
|
|
ARG PHP_OPT_MEMORY_LIMIT=256M
|
|
RUN sed -i "s/^memory_limit = .*/memory_limit = $PHP_OPT_MEMORY_LIMIT/g" /etc/php/${PHP_VERSION}/cli/php.ini
|
|
|
|
ARG PHP_OPT_SHORT_OPEN_TAG=Off
|
|
RUN sed -i "s/^short_open_tag = .*/short_open_tag = $PHP_OPT_SHORT_OPEN_TAG/g" /etc/php/${PHP_VERSION}/cli/php.ini
|
|
|
|
###########################################################################
|
|
# Cleanup & Crontab
|
|
###########################################################################
|
|
|
|
USER root
|
|
|
|
# Clean up
|
|
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
|
|
|
COPY ./crontab/* /etc/cron.d/
|
|
|
|
RUN chmod -R 644 /etc/cron.d
|
|
|
|
#ENTRYPOINT ["/bin/bash","-c","service supervisor start"]
|