47 lines
1.6 KiB
Docker
47 lines
1.6 KiB
Docker
FROM ubuntu:latest
|
|
|
|
ARG USERNAME=laravel
|
|
ARG USER_UID=1080
|
|
|
|
# node version number like "12.22.1" or empty for the latest version
|
|
ARG NODE_VERSION=''
|
|
|
|
# composer version number like "2.1" or empty for the latest version
|
|
ARG COMPOSER_VERSION=''
|
|
|
|
# disables asking for input
|
|
ARG DEBIAN_FRONTEND="noninteractive"
|
|
|
|
ENV NVM_DIR="/home/$USERNAME/.nvm"
|
|
|
|
COPY start-container.sh /usr/local/bin/start-container
|
|
|
|
RUN apt-get -y update
|
|
RUN apt-get install -y curl git 7zip php php-xml php-curl php-xml php-mbstring php-mysql php-gd
|
|
RUN useradd --create-home --uid=${USER_UID} ${USERNAME}
|
|
RUN chmod +x /usr/local/bin/start-container
|
|
RUN echo "install composer"
|
|
RUN curl -o composer-setup.php https://getcomposer.org/installer
|
|
RUN curl -o composer-setup.sig https://composer.github.io/installer.sig
|
|
RUN echo " composer-setup.php" >> composer-setup.sig
|
|
RUN sha384sum -c composer-setup.sig
|
|
RUN if [ -n "$COMPOSER_VERSION" ]; then COMPOSER_VERSION="--${COMPOSER_VERSION}"; fi
|
|
RUN php composer-setup.php --install-dir=/usr/local/bin --filename=composer $COMPOSER_VERSION
|
|
RUN rm composer-setup.php composer-setup.sig /var/www/html/*
|
|
RUN chown $USERNAME:$USERNAME /var/www/html
|
|
|
|
EXPOSE 8080
|
|
|
|
WORKDIR /var/www/html
|
|
|
|
USER $USERNAME
|
|
|
|
RUN echo "install nvm and node" \
|
|
&& curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash \
|
|
&& if [ -z "$NODE_VERSION" ]; then NODE_VERSION="node"; fi \
|
|
&& echo "source $NVM_DIR/nvm.sh" >> /home/$USERNAME/.bashrc \
|
|
&& [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" \
|
|
&& nvm install $NODE_VERSION \
|
|
&& nvm alias default $NODE_VERSION
|
|
|
|
ENTRYPOINT ["start-container"] |